Hi,
If it is hard for you to type each column in a SELECT statement for a table with many columns :
Try these ,
1.) Under Object Explorer , goto Database - > Expand that table - > then drag&drop the desired columns
2.)Enabling Intellisence will help you in typing the required columns quickly - http://technet.microsoft.com/en-us/library/ms173743.aspx
3.)Try below dynamic code :
USE [AdventureWorks2012]
GO
--Consider if you want eliminate StartTime,EndTime & ModifiedDate from SELECT list
DECLARE @Columns VARCHAR(MAX)
SELECT @Columns = COALESCE(@Columns+', ','' )+name
FROM Sys.Columns
WHERE Object_name(Object_id) = 'Shift'
AND name NOT IN ('StartTime','EndTime','ModifiedDate')
--SELECT @Columns
EXEC ('SELECT '+@Columns+' FROM HumanResources.Shift')
As per my knowledge , Yes i do agree that there is no direct solution like you asked for :)
sathya --------- Mark as answered if my post solved your problem and Vote as helpful if my post was useful.
No comments:
Post a Comment