Thursday 4 July 2013

select all columns from all tables

DECLARE @SQL AS VarChar(MAX)
SET @SQL = ''
SELECT @SQL = @SQL + 'SELECT * FROM ' + TABLE_SCHEMA + '.' + TABLE_NAME + CHAR(13)
FROM INFORMATION_SCHEMA.TABLES
EXEC (@SQL)


OR

sp_msforeachtable 'select  * from ?'

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...