-1
我正在創建一個列,它會給我一個隨機數,但是我收到了一些錯誤。必須聲明一個標量變量
CREATE TABLE tblBookInfo
(
AccessionNumber NVARCHAR(MAX)
RandomNumber NVARCHAR(10);
AccNo NVARCHAR(MAX)
@Upper INT;
@Lower INT
SET @Lower = 1
SET @Upper = 9999
Select @RandomNumber = Round (((@Upper - @Lower -1)* RAND() + @Lower), 0)
SET @AccNo = 'LIBBOOKS' + RandomNumber
SELECT @AccNo
Set AccessionNumber = AccNo
)
錯誤:
Incorrect syntax near 'RandomNumber'. Must declare the scalar variable "@Lower". Must declare the scalar variable "@Upper". Must declare the scalar variable "@Upper". Must declare the scalar variable "@AccNo". Must declare the scalar variable "@AccNo".
感謝您的幫助:d