| Author |
Topic |
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-02-26 : 07:49:04
|
| hiin which sys objects the datatype of the colunn is stored????how can i get the datatypes and column names of the specified table. |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-02-26 : 07:50:36
|
| sp_help YOURTABLE"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2008-02-26 : 07:53:59
|
| SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Your Table Name' |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-26 : 07:55:03
|
| orEXEC sp_columns 'your table'MadhivananFailing to plan is Planning to fail |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-02-26 : 07:55:27
|
| I want to get result set columnname and datatype.I want query for that and I use that in another query. |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-02-26 : 07:58:56
|
| thanksI got the result. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-26 : 07:59:56
|
quote: Originally posted by raky I want to get result set columnname and datatype.I want query for that and I use that in another query.
Then use the query suggested by PravinMadhivananFailing to plan is Planning to fail |
 |
|
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2008-02-26 : 08:00:10
|
| Which solution did u use? |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-02-26 : 08:01:52
|
| open up the sql code for "sp_help" on master db.You'll find it all there. |
 |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-02-26 : 08:15:28
|
| hi,if u want to see all Tables information then use this select Distinct s.name as schema_name, t.name as table_name, c.name as column_name, st.name AS DataType, c.length, c.xprec, c.xscale, c.cdefaultfrom sys.syscolumns as cjoin sys.tables as ton t.object_id = c.idjoin sys.schemas as son s.schema_id = t.schema_idinner join SysTypes ST on ST.xusertype = c.xusertype |
 |
|
|
|