请问:怎么在MS给的sqlserver 2005 例子中有这么多错误:
比如:在 Integrated Samples 下的 DB3D 的相关脚本中
IF EXISTS (SELECT [name] FROM [master].[sys].[databases] WHERE [name] = N'db3d')
DROP DATABASE [db3d];
-- If the database has any other open connections close the network connection.
IF @@ERROR = 3702
RAISERROR('[db3d] database cannot be dropped because there are still other open connections', 127, 127) WITH NOWAIT, LOG;
GO
CREATE DATABASE db3d
GO
USE db3d
GO
-- create CLR objects (assemblies, aggregates and UDTs)
DECLARE @SamplesPath nvarchar(1024)
-- You may need to modify the value of the this variable if you have installed the sample someplace other than the default location.
SELECT @SamplesPath = replace(physical_name, 'Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf', 'Microsoft SQL Server\90\Samples\Integrated Samples\')
FROM master.sys.database_files
WHERE name = 'master';
CREATE ASSEMBLY db3dsql FROM @SamplesPath + 'DB3D\CS\db3dsql\bin\debug\db3dsql.dll'
GO
CREATE TYPE Point3D EXTERNAL NAME db3dsql.[Microsoft.Samples.SqlServer.DB3D.Point3D]
GO
CREATE TYPE Triangle3D EXTERNAL NAME db3dsql.[Microsoft.Samples.SqlServer.DB3D.Triangle]
GO
CREATE AGGREGATE Surface (@input Triangle3D) RETURNS FLOAT
EXTERNAL NAME db3dsql.[Microsoft.Samples.SqlServer.DB3D.Surface]
GO
-- create tables
CREATE TABLE Wireframe (
WireframeID INT NOT NULL PRIMARY KEY IDENTITY(1,1),
WireframeName VARCHAR(255) NOT NULL UNIQUE
)
CREATE TABLE Triangle (
TriangleID INT NOT NULL PRIMARY KEY NONCLUSTERED IDENTITY(1,1),
WireframeID INT NOT NULL REFERENCES Wireframe (WireframeID),
TriangleObj Triangle3D NOT NULL
)
CREATE CLUSTERED INDEX IX_Triangle_WireframeID ON Triangle (WireframeID)
GO
-- create stored-procedures
CREATE PROCEDURE GetWireframe (@WireframeID INT, @WireframeName VARCHAR(255) OUTPUT) AS
SELECT @WireframeName = WireframeName FROM Wireframe WHERE WireframeID = @WireframeID
SELECT TriangleID, TriangleObj FROM Triangle WHERE WireframeID = @WireframeID
GO
CREATE PROCEDURE CreateWireframe (@WireframeName VARCHAR(255)) AS
INSERT INTO Wireframe (WireframeName) VALUES (@WireframeName)
SELECT SCOPE_IDENTITY()
GO
CREATE PROCEDURE ListWireframes AS
SELECT WireframeID, WireframeName FROM Wireframe ORDER BY WireframeName
GO
CREATE PROCEDURE ListWireframesDetailed AS
SELECT w.WireframeID, WireframeName, COUNT(*) AS TriangleCount, dbo.Surface(t.TriangleObj) AS Surface
FROM Wireframe w
INNER JOIN Triangle t ON w.WireframeID = t.WireframeID
GROUP BY w.WireframeID, WireframeName
GO
CREATE PROCEDURE CreateTriangle (@WireframeID INT, @Triangle Triangle3D) AS
INSERT INTO Triangle (WireframeID, TriangleObj) VALUES (@WireframeID, @Triangle)
SELECT SCOPE_IDENTITY()
GO
CREATE PROCEDURE DeleteWireframe (@WireframeID INT) AS
DELETE FROM Triangle WHERE WireframeID = @WireframeID
DELETE FROM Wireframe WHERE WireframeID = @WireframeID
GO
错误如下:
Msg 170, Level 15, State 1, Line 10
第 10 行: 'ASSEMBLY' 附近有语法错误。
Msg 170, Level 15, State 1, Line 2
第 2 行: 'TYPE' 附近有语法错误。
Msg 170, Level 15, State 1, Line 2
第 2 行: 'TYPE' 附近有语法错误。
Msg 170, Level 15, State 1, Line 2
第 2 行: 'AGGREGATE' 附近有语法错误。
我是直接把相应的脚本放在Sql Server Management Studio 中的New query 中执行的.
请帮帮我...............