Tuesday, August 10, 2010

MSSQL select value into variable

Declare
@intTableCount int



set @intTableCount = (select COUNT(*) from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'dbo'
and TABLE_NAME = 'Table_Name')

select @intTableCount
 
It will trow an error if you omit the ( and ) .
 
Till Next Time

No comments: