Create Variables & Columns

The data type is a built-in data type in SQL Server and is somewhat similar to other built-in types s

The

data type is a built-in data type in SQL Server and is somewhat similar to other built-in

types such as

and. As with other built-in types, you can use the

data type as a

column type when you create a table as a variable type, a parameter type, a function-return

type, or in

CAST and CONVERT.

To create an

type column as part of a table, use a

statement, as shown in the

following example:

You can use a

to create a variable of

type, as the following example

shows.

Create a typed

variable by specifying an XML schema collection, as shown in the following

example.

To pass an

type parameter to a stored procedure, use a

statement, as

shown in the following example.

xml
CREATE TABLE
DECLARE statement xml xml xml
CREATE PROCEDURE
CREATE
TABLE
T1(Col1 int primary key
, Col2 xml
);
DECLARE
@x xml
;
DECLARE
@x xml (Sales.StoreSurveySchemaCollection)
CREATE
PROCEDURE
SampleProc(@XmlDoc xml
)
AS.