首页 > 中学考试杂题 > 题目详情
下面SQL 中的;with 为什么一定要加上':with'呢,起什么作用呢.;with digits (i) as(--
题目内容:
下面SQL 中的;with 为什么一定要加上':with'呢,起什么作用呢.
;with
digits (i) as(--set up a set of numbers from 0-9
select i
from (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) as digits (i))
--builds a table from 0 to 99999
,sequence (i) as (
SELECT D1.i + (10*D2.i) + (100*D3.i) + (1000*D4.i) + (10000*D5.i)
FROM digits AS D1 CROSS JOIN digits AS D2 CROSS JOIN digits AS D3
CROSS JOIN digits AS D4 CROSS JOIN digits AS D5)
select i,nchar(i) as character
from sequence
where i between 48 and 122 --vary to include any characters
--in the character set of choice
order by nchar(i) collate Latin1_General_bin --change to the collation you
--are trying
GO
下面SQL 中的;with 为什么一定要加上':with'呢,起什么作用呢.
;with
digits (i) as(--set up a set of numbers from 0-9
select i
from (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) as digits (i))
--builds a table from 0 to 99999
,sequence (i) as (
SELECT D1.i + (10*D2.i) + (100*D3.i) + (1000*D4.i) + (10000*D5.i)
FROM digits AS D1 CROSS JOIN digits AS D2 CROSS JOIN digits AS D3
CROSS JOIN digits AS D4 CROSS JOIN digits AS D5)
select i,nchar(i) as character
from sequence
where i between 48 and 122 --vary to include any characters
--in the character set of choice
order by nchar(i) collate Latin1_General_bin --change to the collation you
--are trying
GO
;with
digits (i) as(--set up a set of numbers from 0-9
select i
from (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) as digits (i))
--builds a table from 0 to 99999
,sequence (i) as (
SELECT D1.i + (10*D2.i) + (100*D3.i) + (1000*D4.i) + (10000*D5.i)
FROM digits AS D1 CROSS JOIN digits AS D2 CROSS JOIN digits AS D3
CROSS JOIN digits AS D4 CROSS JOIN digits AS D5)
select i,nchar(i) as character
from sequence
where i between 48 and 122 --vary to include any characters
--in the character set of choice
order by nchar(i) collate Latin1_General_bin --change to the collation you
--are trying
GO
本题链接: