SQL Code Helper Tip: AUTO pull a fully qualified name table or view column list

  • ….. using  the QUOTENAME function. To get a copy paste list, enter the table name in both places and then run as query to text in SQL Query Analyzer.
    SELECT ‘,[dbo].[your_table_name].’ + quotename(name, ‘]’)
    FROM dbo.syscolumns WITH (NOLOCK)
    WHERE id = object_id(‘your_table_name’)
    ORDER BY colid

On Demand Expert MS BI Training – Free Trial

Microsoft Store

{view more tips on this site}

This site uses Akismet to reduce spam. Learn how your comment data is processed.