columns in select list
-
Thursday, October 13, 2005 10:27 AM
hi friends!
Suppose, i have a query:
SELECT fname AS Firstname, lname AS Lastname FROM Customer
Now is it possible to get the column names produced by the above query? Like
Firstname
Lastname
just like we extract column names from information_schema.columns for a table name?
with regards,
Buragohain
All Replies
-
Thursday, October 13, 2005 7:31 AM
In your client, sure -- every client library can do that. In SQL Server, probably not.What is the business or technical problem you're trying to solve? Perhaps we can come up with a better way of handling it.<buragohain@discussions.microsoft.com> wrote in message news:6926c563-86b6-40a5-a3f0-3bc32f8e9e94@discussions.microsoft.com...hi friends!
Suppose, i have a query:
SELECT fname AS Firstname, lname AS Lastname FROM Customer
Now is it possible to get the column names produced by the above query? Like
Firstname
Lastname
just like we extract column names from information_schema.columns for a table name?
with regards,
Buragohain -
Thursday, October 13, 2005 1:22 PMWhat are you consuming it with? ADO with vb? ado.net ?
-
Friday, October 14, 2005 5:12 AMHi friends!
Thanx everyone for your response.
By creating a temporary table using the query, then accessing the columns, and then deleting the temporary table, will solve the problem. But i wonder is there any in-built technique is Sql server for that or not. Like:
exec sp_columns 'Customer'
exec sp_columns 'select * from Customer' (wrong)
exec sp_columns 'SELECT fname AS Firstname, lname AS Lastname FROM Customer' (wrong)
Again, if there is any technique in ADO.NET, then it will be helpfull too.
(my problem was to show friendly column names to end user from several tables joined.)
with regards,

