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 2000 Forums
 SQL Server Development (2000)
 sql server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-12-12 : 08:32:05
sireesha writes "how can we return entire column data a of a query using funtions


ex:
create function func(@tname nvarchar(128))
returns nvarchar(128)
as
begin
select column_name from information_schema.columns
where table_name = @tname

return column_name --return entire column values
end "

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-12-12 : 09:05:57
[code]create function dbo.func (@tname nvarchar(128))
returns @t table (tablename nvarchar(128), columnname nvarchar(128) )
as
begin
insert into @t
select @tname,column_name
from information_schema.columns
where table_name = @tname
return
end
go

select * from dbo.func('TABLES')
go

drop function dbo.func
[/code]
Go to Top of Page
   

- Advertisement -