a guest Jul 18th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- DECLARE @C_Names VARCHAR(MAX)
- DECLARE @T_Name VARCHER(MAX)
- SET @C_Names = '[ID], [DateAdded], [TenantID]'
- SET @T_Name = 'your_table_name'
- --AS column names are fixed, you can now change the table name
- --only and execute the script to get your desired output
- EXEC('SELECT '+@C_Names+' FROM '+@T_Name+'')
RAW Paste Data