Skip to main content
added 29 characters in body
Source Link

T-SQL 134

This challenge is asking to return the Cartesian power of {(0),(1)}. My SQL attemptThis snippet builds the code which would execute the Cartesian product of {(0),(1)} n times using a variable.

DECLARE @ int=4,@s varchar(max)='SELECT*FROM's:set @s+='(VALUES(0),(1))t'+ltrim(@)+'(b)'if @>1set @s+=','set @-=1if @>0goto s exec(@s)

T-SQL 134

This challenge is asking to return the Cartesian power of {(0,1)}. My SQL attempt builds the Cartesian product n times using a variable.

DECLARE @ int=4,@s varchar(max)='SELECT*FROM's:set @s+='(VALUES(0),(1))t'+ltrim(@)+'(b)'if @>1set @s+=','set @-=1if @>0goto s exec(@s)

T-SQL 134

This challenge is asking to return the Cartesian power of {(0),(1)}. This snippet builds the code which would execute the Cartesian product of {(0),(1)} n times.

DECLARE @ int=4,@s varchar(max)='SELECT*FROM's:set @s+='(VALUES(0),(1))t'+ltrim(@)+'(b)'if @>1set @s+=','set @-=1if @>0goto s exec(@s)
Source Link

T-SQL 134

This challenge is asking to return the Cartesian power of {(0,1)}. My SQL attempt builds the Cartesian product n times using a variable.

DECLARE @ int=4,@s varchar(max)='SELECT*FROM's:set @s+='(VALUES(0),(1))t'+ltrim(@)+'(b)'if @>1set @s+=','set @-=1if @>0goto s exec(@s)