Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2007-11-19 : 06:08:23
|
Can anyone please give me the equivalent sql for sql server 2000 for the following two queries1-- Full Table Structureselect t.object_id, t.name as 'tablename', c.name as 'columnname', y.name as 'typename', case y.name when 'varchar' then convert(varchar, c.max_length) when 'decimal' then convert(varchar, c.precision) + ', ' + convert(varchar, c.scale) else ''end attrib,y.*from sys.tables t, sys.columns c, sys.types ywhere t.object_id = c.object_idand t.name not in ('sysdiagrams')and c.system_type_id = y.system_type_idand c.system_type_id = y.user_type_idorder by t.name, c.column_id2-- PK and Indexselect t.name as 'tablename', i.name as 'indexname', c.name as 'columnname' , i.is_unique, i.is_primary_key, ic.is_descending_keyfrom sys.indexes i, sys.tables t, sys.index_columns ic, sys.columns cwhere t.object_id = i.object_idand t.object_id = ic.object_idand t.object_id = c.object_idand i.index_id = ic.index_idand c.column_id = ic.column_idand t.name not in ('sysdiagrams')order by t.name, i.index_id, ic.index_column_idThis sql is extracting some sort of the information about the structure of the sql server data base[2005 version i also need this for sql server 2000 version]Kamran ShahidSr. Software Engineer(MCSD.Net)www.netprosys.com |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-19 : 09:05:06
|
why don't you use INFORMATION_SCHEMA ? It will works on both SQL 2000 and 2005 KH[spoiler]Time is always against us[/spoiler] |
 |
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2007-11-19 : 11:08:13
|
I will accept any thing which will work in both.Can you help me in the tsql with that ?Kamran ShahidSr. Software Engineer(MCSD.Net)www.netprosys.com |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|
|