我试图让以下内容在sql Server中工作时遇到一些困难:
CREATE TABLE table_X AS SELECT NEXT VALUE FOR GROUP_A AS GROUP_ID,RISK_ID FROM ( SELECT UNIQUE RISK_ID,FROM table_Y ) SS;
有人告诉我:
"Incorrect Syntax near the keyword 'SELECT'." "Incorrect Syntax near the keyword 'UNIQUE'."
解决方法
CREATE TABLE Person ( FirstName Varchar(50),LastName Varchar(50) ); /* Insert Some Values Into Person */ CREATE SEQUENCE CountBy START WITH 1 INCREMENT BY 1 ; SELECT NEXT VALUE FOR CountBy OVER (ORDER BY LastName) AS ListNumber,FirstName,LastName INTO table_x FROM Person