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 |
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2006-05-26 : 10:29:26
|
| Hi,i have a table lets say dynamic and i wanna get the names of the columns. Is it possible with select?thanks |
|
|
sanjnep
Posting Yak Master
191 Posts |
Posted - 2006-05-26 : 10:39:18
|
| select name as [col name] from syscolumns where id = object_id('dynamic')Sanjeev Shrestha12/17/1963 |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-05-26 : 11:04:54
|
| or...SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'dynamic'Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-26 : 11:21:49
|
| or Select top 0 * from dynamicSrinika |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-05-26 : 11:29:38
|
quote: Originally posted by Srinika or Select top 0 * from dynamicSrinika
If you use variable that has table name that wont work without dynamic sql. Also it will have column headers with no data and will not column namesMadhivananFailing to plan is Planning to fail |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-05-27 : 02:24:13
|
quote: Originally posted by X002548 What's a dynamic table?I know of virtual table, a derived table, a local temp table, a global temp table, your general run of the mill physical table, a table variable, but I have never heard of a dynamic tableBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam
I think the questioner wants to pass table name as parameterMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|