July 12, 2005 at 12:15 am
July 12, 2005 at 12:35 am
Arun,
Try something like:
select column_name
,data_type
,character_maximum_length
,numeric_precision
,numeric_scale
from information_schema.columns
where table_name = 'myTable'
Hope this helps,
Scott Thornburg
July 12, 2005 at 1:05 am
Soctt,
My requirement was to find the datatype of the column hence i tried the following query
select 'au_id' from information_schema.columns where table_name = 'authors'
I'm using the pubs database and in that using the authors table...and trying to find out the datatype of anyof the column.
But the result weren't as desired.
Regards
Arun
July 12, 2005 at 2:20 am
Use:
sp_columns <table name>
Charles Wilkinson, Database Administrator, Sastek Pty Ltd
Charles Wilkinson
Database Administrator
Sastek Pty Ltd
www.sastek.com
July 12, 2005 at 3:12 am
Charles
Thanks a ton that worked like a chum...can't we do it for a single column.
Just now learning all the sql commands from books online, do let me know how do i get hands on queries.
Cheers
Arun
July 12, 2005 at 5:23 am
Arun...is this what you're looking for ?!
select column_name, data_type from information_schema.columns where table_name = 'authors' and column_name = 'au_id'
**ASCII stupid question, get a stupid ANSI !!!**
July 12, 2005 at 5:42 am
sushila,
THANKS(big one)!
That solved my 2 day search on books online(this shows how bad i'm), i was trying my hands on columnproperty...
And now from sql commands i'm migrating to combining these commands into queries...do let me know where i can get some practice on queries.
Cheers
Arun
July 12, 2005 at 5:50 am
You're welcome!
This link should set you off to a good start:
http://www.w3schools.com/sql/default.asp
**ASCII stupid question, get a stupid ANSI !!!**
July 13, 2005 at 7:32 am
Actually this one worked too.. you just had to execute it from the pubs database.
" select column_name
,data_type
,character_maximum_length
,numeric_precision
,numeric_scale
from information_schema.columns
where table_name = 'myTable'
"
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply