July 25, 2008 at 7:19 pm
Hi!
In need to find a field name in all the tables of a database.
July 25, 2008 at 8:02 pm
Check out the system views sys.columns or information_schema.columns.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
July 25, 2008 at 11:39 pm
hi
here is solution
SELECT SO.NAME AS "Table Name", SC.NAME AS "Column Name", SM.TEXT AS "Default Value"
FROM dbo.sysobjects SO INNER JOIN dbo.syscolumns SC ON SO.id = SC.id
LEFT JOIN dbo.syscomments SM ON SC.cdefault = SM.id
WHERE SO.xtype = 'U'
ORDER BY SO.[name], SC.colid
July 26, 2008 at 1:55 pm
Much easier:
Select * From INFORMATION_SCHEMA.COLUMNS
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
July 26, 2008 at 11:57 pm
Hope this will help you,
select * from sys.columns a inner join sys.objects b on a.object_id=b.object_id
where a.[name] = 'last_update_by'
Thanks and Regards,
Venkatesan Prabu, 😛
My Blog:
http://venkattechnicalblog.blogspot.com/
July 27, 2008 at 1:50 pm
Thanks for all your hep!!!!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply