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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Table Name

Author  Topic 

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2009-05-19 : 16:03:45
I am writing a query in sql 2005 but need the name of the table in my results. Is there a way to do this?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-19 : 21:23:36
this ?

select col1, col2, table_name = 'table123'
from table123



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-05-20 : 02:25:04
this?lol
select tablename=so.name from sysobjects so
Go to Top of Page
   

- Advertisement -