Monday, March 12, 2012

script in 2005 cannot be run on sql server 2000

for e.g.
in 2005
SELECT * FROM sys.foreign_keys....(no error)
in sql server 2000
SELECT * FROM sys.foreign_keys....(Invalid object name 'sys.foreign_keys'.)
SELECT * FROM sys.indexes WHERE object_id = .......
(no problem in sql server 2005, but have problem in sql server 2000)
so how to handle these case?
Is it possible to write script which can be run on both sql server 2005 and
sql server 2000?Yes, it is possible to write those scripts to they can run on both SQL
Server 2000 and SQL Server 2005. But you need to look for names like
sysindexes and sysforeignkeys. In the documentation (BOL) they are called
system tables in SQL Server 2000 and compatibility views on SQL Server 2005.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"kei" wrote:
> for e.g.
> in 2005
> SELECT * FROM sys.foreign_keys....(no error)
> in sql server 2000
> SELECT * FROM sys.foreign_keys....(Invalid object name 'sys.foreign_keys'.)
> SELECT * FROM sys.indexes WHERE object_id = .......
> (no problem in sql server 2005, but have problem in sql server 2000)
> so how to handle these case?
> Is it possible to write script which can be run on both sql server 2005 and
> sql server 2000?|||so what should I do now to convert the already written sql 2005 script to run
on sql 2000 server?
"Ben Nevarez" wrote:
> Yes, it is possible to write those scripts to they can run on both SQL
> Server 2000 and SQL Server 2005. But you need to look for names like
> sysindexes and sysforeignkeys. In the documentation (BOL) they are called
> system tables in SQL Server 2000 and compatibility views on SQL Server 2005.
> Hope this helps,
> Ben Nevarez
> Senior Database Administrator
> AIG SunAmerica
>
> "kei" wrote:
> > for e.g.
> > in 2005
> > SELECT * FROM sys.foreign_keys....(no error)
> > in sql server 2000
> > SELECT * FROM sys.foreign_keys....(Invalid object name 'sys.foreign_keys'.)
> >
> > SELECT * FROM sys.indexes WHERE object_id = .......
> > (no problem in sql server 2005, but have problem in sql server 2000)
> >
> > so how to handle these case?
> > Is it possible to write script which can be run on both sql server 2005 and
> > sql server 2000?|||This sounds like going backwards, that is, moving from SQL Server 2005 to
SQL Server 2000. For SQL Server 2005, Microsoft recommends to use the new
catalog views (like sys.indexes) and the compatibility views (like
sysindexes) are for backward compatibility only.
So, what I would do is to leave the existing scripts for SQL Server 2005
unchanged and just create similar ones just for SQL Server 2000.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"kei" wrote:
> so what should I do now to convert the already written sql 2005 script to run
> on sql 2000 server?
> "Ben Nevarez" wrote:
> >
> > Yes, it is possible to write those scripts to they can run on both SQL
> > Server 2000 and SQL Server 2005. But you need to look for names like
> > sysindexes and sysforeignkeys. In the documentation (BOL) they are called
> > system tables in SQL Server 2000 and compatibility views on SQL Server 2005.
> >
> > Hope this helps,
> >
> > Ben Nevarez
> > Senior Database Administrator
> > AIG SunAmerica
> >
> >
> >
> > "kei" wrote:
> >
> > > for e.g.
> > > in 2005
> > > SELECT * FROM sys.foreign_keys....(no error)
> > > in sql server 2000
> > > SELECT * FROM sys.foreign_keys....(Invalid object name 'sys.foreign_keys'.)
> > >
> > > SELECT * FROM sys.indexes WHERE object_id = .......
> > > (no problem in sql server 2005, but have problem in sql server 2000)
> > >
> > > so how to handle these case?
> > > Is it possible to write script which can be run on both sql server 2005 and
> > > sql server 2000?|||NO, I really want to write a script that can be run on both sql server 2000
and 2005, not 1 script for each version, so how can I change the sql server
2005 script to script that can be run on sql server 2000 and sql server 2005?
SELECT * FROM sys.foreign_keys WHERE object_id = ......
SELECT * FROM sys.indexes WHERE object_id =........
how to change the above statement? any concrete example of how to change?
thx!!
"Ben Nevarez" wrote:
> This sounds like going backwards, that is, moving from SQL Server 2005 to
> SQL Server 2000. For SQL Server 2005, Microsoft recommends to use the new
> catalog views (like sys.indexes) and the compatibility views (like
> sysindexes) are for backward compatibility only.
> So, what I would do is to leave the existing scripts for SQL Server 2005
> unchanged and just create similar ones just for SQL Server 2000.
> Hope this helps,
> Ben Nevarez
> Senior Database Administrator
> AIG SunAmerica
>
> "kei" wrote:
> > so what should I do now to convert the already written sql 2005 script to run
> > on sql 2000 server?
> >
> > "Ben Nevarez" wrote:
> >
> > >
> > > Yes, it is possible to write those scripts to they can run on both SQL
> > > Server 2000 and SQL Server 2005. But you need to look for names like
> > > sysindexes and sysforeignkeys. In the documentation (BOL) they are called
> > > system tables in SQL Server 2000 and compatibility views on SQL Server 2005.
> > >
> > > Hope this helps,
> > >
> > > Ben Nevarez
> > > Senior Database Administrator
> > > AIG SunAmerica
> > >
> > >
> > >
> > > "kei" wrote:
> > >
> > > > for e.g.
> > > > in 2005
> > > > SELECT * FROM sys.foreign_keys....(no error)
> > > > in sql server 2000
> > > > SELECT * FROM sys.foreign_keys....(Invalid object name 'sys.foreign_keys'.)
> > > >
> > > > SELECT * FROM sys.indexes WHERE object_id = .......
> > > > (no problem in sql server 2005, but have problem in sql server 2000)
> > > >
> > > > so how to handle these case?
> > > > Is it possible to write script which can be run on both sql server 2005 and
> > > > sql server 2000?|||I am affraid that there is no automatic way to convert the scripts. Check on
the SQL Server documentation (Books Online) for the description of both the
sysindexes and sysforeignkeys system tables/compatibility views.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"kei" wrote:
> NO, I really want to write a script that can be run on both sql server 2000
> and 2005, not 1 script for each version, so how can I change the sql server
> 2005 script to script that can be run on sql server 2000 and sql server 2005?
> SELECT * FROM sys.foreign_keys WHERE object_id = ......
> SELECT * FROM sys.indexes WHERE object_id =........
> how to change the above statement? any concrete example of how to change?
> thx!!
> "Ben Nevarez" wrote:
> >
> > This sounds like going backwards, that is, moving from SQL Server 2005 to
> > SQL Server 2000. For SQL Server 2005, Microsoft recommends to use the new
> > catalog views (like sys.indexes) and the compatibility views (like
> > sysindexes) are for backward compatibility only.
> >
> > So, what I would do is to leave the existing scripts for SQL Server 2005
> > unchanged and just create similar ones just for SQL Server 2000.
> >
> > Hope this helps,
> >
> > Ben Nevarez
> > Senior Database Administrator
> > AIG SunAmerica
> >
> >
> >
> > "kei" wrote:
> >
> > > so what should I do now to convert the already written sql 2005 script to run
> > > on sql 2000 server?
> > >
> > > "Ben Nevarez" wrote:
> > >
> > > >
> > > > Yes, it is possible to write those scripts to they can run on both SQL
> > > > Server 2000 and SQL Server 2005. But you need to look for names like
> > > > sysindexes and sysforeignkeys. In the documentation (BOL) they are called
> > > > system tables in SQL Server 2000 and compatibility views on SQL Server 2005.
> > > >
> > > > Hope this helps,
> > > >
> > > > Ben Nevarez
> > > > Senior Database Administrator
> > > > AIG SunAmerica
> > > >
> > > >
> > > >
> > > > "kei" wrote:
> > > >
> > > > > for e.g.
> > > > > in 2005
> > > > > SELECT * FROM sys.foreign_keys....(no error)
> > > > > in sql server 2000
> > > > > SELECT * FROM sys.foreign_keys....(Invalid object name 'sys.foreign_keys'.)
> > > > >
> > > > > SELECT * FROM sys.indexes WHERE object_id = .......
> > > > > (no problem in sql server 2005, but have problem in sql server 2000)
> > > > >
> > > > > so how to handle these case?
> > > > > Is it possible to write script which can be run on both sql server 2005 and
> > > > > sql server 2000?|||I am willing to modify it manually, but don't know how to change manually, do
you have any idea?
"Ben Nevarez" wrote:
> I am affraid that there is no automatic way to convert the scripts. Check on
> the SQL Server documentation (Books Online) for the description of both the
> sysindexes and sysforeignkeys system tables/compatibility views.
> Hope this helps,
> Ben Nevarez
> Senior Database Administrator
> AIG SunAmerica
>
> "kei" wrote:
> > NO, I really want to write a script that can be run on both sql server 2000
> > and 2005, not 1 script for each version, so how can I change the sql server
> > 2005 script to script that can be run on sql server 2000 and sql server 2005?
> > SELECT * FROM sys.foreign_keys WHERE object_id = ......
> > SELECT * FROM sys.indexes WHERE object_id =........
> > how to change the above statement? any concrete example of how to change?
> > thx!!
> >
> > "Ben Nevarez" wrote:
> >
> > >
> > > This sounds like going backwards, that is, moving from SQL Server 2005 to
> > > SQL Server 2000. For SQL Server 2005, Microsoft recommends to use the new
> > > catalog views (like sys.indexes) and the compatibility views (like
> > > sysindexes) are for backward compatibility only.
> > >
> > > So, what I would do is to leave the existing scripts for SQL Server 2005
> > > unchanged and just create similar ones just for SQL Server 2000.
> > >
> > > Hope this helps,
> > >
> > > Ben Nevarez
> > > Senior Database Administrator
> > > AIG SunAmerica
> > >
> > >
> > >
> > > "kei" wrote:
> > >
> > > > so what should I do now to convert the already written sql 2005 script to run
> > > > on sql 2000 server?
> > > >
> > > > "Ben Nevarez" wrote:
> > > >
> > > > >
> > > > > Yes, it is possible to write those scripts to they can run on both SQL
> > > > > Server 2000 and SQL Server 2005. But you need to look for names like
> > > > > sysindexes and sysforeignkeys. In the documentation (BOL) they are called
> > > > > system tables in SQL Server 2000 and compatibility views on SQL Server 2005.
> > > > >
> > > > > Hope this helps,
> > > > >
> > > > > Ben Nevarez
> > > > > Senior Database Administrator
> > > > > AIG SunAmerica
> > > > >
> > > > >
> > > > >
> > > > > "kei" wrote:
> > > > >
> > > > > > for e.g.
> > > > > > in 2005
> > > > > > SELECT * FROM sys.foreign_keys....(no error)
> > > > > > in sql server 2000
> > > > > > SELECT * FROM sys.foreign_keys....(Invalid object name 'sys.foreign_keys'.)
> > > > > >
> > > > > > SELECT * FROM sys.indexes WHERE object_id = .......
> > > > > > (no problem in sql server 2005, but have problem in sql server 2000)
> > > > > >
> > > > > > so how to handle these case?
> > > > > > Is it possible to write script which can be run on both sql server 2005 and
> > > > > > sql server 2000?|||I believe Ben's trying to say that you should go to BOL and look for SQL
Server 2000 commands that is equal to the ones you used in your SQL Server
2005 scripts and go that way.
You can check if it's a SQL Server 2000 or 2005 before starting other
commands in your script and then you could use 2000 or 2005 commands
according to the version of the SQL Server that you run your script.
--
Ekrem Ã?nsoy
"kei" <kei@.discussions.microsoft.com> wrote in message
news:6942143B-33F0-476F-A030-3BE4DF2AC220@.microsoft.com...
>I am willing to modify it manually, but don't know how to change manually,
>do
> you have any idea?
> "Ben Nevarez" wrote:
>> I am affraid that there is no automatic way to convert the scripts. Check
>> on
>> the SQL Server documentation (Books Online) for the description of both
>> the
>> sysindexes and sysforeignkeys system tables/compatibility views.
>> Hope this helps,
>> Ben Nevarez
>> Senior Database Administrator
>> AIG SunAmerica
>>
>> "kei" wrote:
>> > NO, I really want to write a script that can be run on both sql server
>> > 2000
>> > and 2005, not 1 script for each version, so how can I change the sql
>> > server
>> > 2005 script to script that can be run on sql server 2000 and sql server
>> > 2005?
>> > SELECT * FROM sys.foreign_keys WHERE object_id = ......
>> > SELECT * FROM sys.indexes WHERE object_id =........
>> > how to change the above statement? any concrete example of how to
>> > change?
>> > thx!!
>> >
>> > "Ben Nevarez" wrote:
>> >
>> > >
>> > > This sounds like going backwards, that is, moving from SQL Server
>> > > 2005 to
>> > > SQL Server 2000. For SQL Server 2005, Microsoft recommends to use the
>> > > new
>> > > catalog views (like sys.indexes) and the compatibility views (like
>> > > sysindexes) are for backward compatibility only.
>> > >
>> > > So, what I would do is to leave the existing scripts for SQL Server
>> > > 2005
>> > > unchanged and just create similar ones just for SQL Server 2000.
>> > >
>> > > Hope this helps,
>> > >
>> > > Ben Nevarez
>> > > Senior Database Administrator
>> > > AIG SunAmerica
>> > >
>> > >
>> > >
>> > > "kei" wrote:
>> > >
>> > > > so what should I do now to convert the already written sql 2005
>> > > > script to run
>> > > > on sql 2000 server?
>> > > >
>> > > > "Ben Nevarez" wrote:
>> > > >
>> > > > >
>> > > > > Yes, it is possible to write those scripts to they can run on
>> > > > > both SQL
>> > > > > Server 2000 and SQL Server 2005. But you need to look for names
>> > > > > like
>> > > > > sysindexes and sysforeignkeys. In the documentation (BOL) they
>> > > > > are called
>> > > > > system tables in SQL Server 2000 and compatibility views on SQL
>> > > > > Server 2005.
>> > > > >
>> > > > > Hope this helps,
>> > > > >
>> > > > > Ben Nevarez
>> > > > > Senior Database Administrator
>> > > > > AIG SunAmerica
>> > > > >
>> > > > >
>> > > > >
>> > > > > "kei" wrote:
>> > > > >
>> > > > > > for e.g.
>> > > > > > in 2005
>> > > > > > SELECT * FROM sys.foreign_keys....(no error)
>> > > > > > in sql server 2000
>> > > > > > SELECT * FROM sys.foreign_keys....(Invalid object name
>> > > > > > 'sys.foreign_keys'.)
>> > > > > >
>> > > > > > SELECT * FROM sys.indexes WHERE object_id = .......
>> > > > > > (no problem in sql server 2005, but have problem in sql server
>> > > > > > 2000)
>> > > > > >
>> > > > > > so how to handle these case?
>> > > > > > Is it possible to write script which can be run on both sql
>> > > > > > server 2005 and
>> > > > > > sql server 2000?

No comments:

Post a Comment