Skip to content

Instantly share code, notes, and snippets.

@codeodor
Created August 3, 2010 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeodor/506806 to your computer and use it in GitHub Desktop.
Save codeodor/506806 to your computer and use it in GitHub Desktop.
SELECT DISTINCT 'script/generate scaffold ' + t.name + ' ' + column_names
FROM sys.tables t
CROSS APPLY (
SELECT c.name +
case when max_length > 255 then ':text' else ':string' end + ' '
FROM sys.columns c
WHERE c.object_id = t.object_id
ORDER BY c.column_id
FOR XML PATH('') ) dummy_identifier ( column_names )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment