I was wondering if there\'s a limit on a number of UNION\'ed SELECT statements I can send to an SQL Server? I may have up to 36 done in one SQL statement, so it becomes quit
From SQL 2008 BOL
"Any number of UNION operators can appear in a Transact-SQL statement"
Also from MSDN "Maximum Capacity Specifications for SQL Server" (2008):
Batch size (1) 65,536 * Network Packet Size
Length of a string containing SQL statements (batch size) (1) 65,536 * Network packet size
(1) Network Packet Size is the size of the tabular data stream (TDS) packets used to communicate between applications and the relational Database Engine. The default packet size is 4 KB, and is controlled by the network packet size configuration option.
To my mind, that means 268,435,456 bytes when using defaults. Please say your query is shorter than that.