Hello, it seems I forgot how to do it,
I want to create a query to get the column description table, I mean get structure without data.
I remember it was select DESC or something like that, donno if im right!!!
regards
select * from information_schema.columns where table_name='foo'
DESC tells you to sort your results in descending order
--
James
|||
Well, I am not sure about DESC, but I used to work with SQL*Plus in Oracle, and I used to do so, it will give me just the columns and datatypes.
So, thanks a lot
regards
|||There are several ways you can do this.My preferred method is using one of the INFORMATION_SCHEMA views:
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'myTable'
Alternately, you could use the sp_columns stored procedure
EXEC sp_columns 'myTable'
You could also directly query the sysobjects, etc. tables but I don't recommend that approach.
|||
Terri, thanks dear a lot.
Regards
|||Don't you just love vendor extensions
standard SQL uses this format to give you the result set in descending order
SELECT * FROM TITLES ORDER BY PRICE DESC
SQL*Plus uses
DESC[RIBE] table_name to give you column information.
Who says you can't reuse keywords ?
|||
Thanks my friend, I used that once, but as I mentioned I forgot how, and whether its applicable in SQL Server.
regards
No comments:
Post a Comment