Re: Using "Table" variable
From: Uri Dimant (urid_at_iscar.co.il)
Date: 11/03/04
- Next message: Peter: "Re: How to create a table with many same type fields by coding?"
- Previous message: Andy Phillips: "auto backup and restore"
- In reply to: Adam Machanic: "Re: Using "Table" variable"
- Next in thread: Hugo Kornelis: "Re: Using "Table" variable"
- Reply: Hugo Kornelis: "Re: Using "Table" variable"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 3 Nov 2004 08:29:35 +0200
Adam
> Table variables are actually created in TEMPDB
Does not SQL Server create and manage it in the memory?
"Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message
news:OMSEbiQwEHA.536@TK2MSFTNGP11.phx.gbl...
> Vijay,
>
> Table variables are actually created in TEMPDB, so you will get the
> collation from that database by default. You could try to fix this by
using
> database_default instead of specifying an actual collation name:
>
>
> DECLARE @Order_Numbers_Table TABLE
> (
> [Serial] INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
> [Order] CHAR(11) COLLATE database_default
> )
>
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
>
> "Vijay" <vijay@infosysusa.com> wrote in message
> news:eBp4SXQwEHA.1260@TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > I am trying to use the "table" variable in the stored procedure as
> follows.
> >
> > DECLARE @Order_Numbers_Table TABLE
> > (
> > [Serial] INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
> > [Order] CHAR(11)
> > )
> >
> > My current database and its objects are in the collation named "COLLATE
> > SQL_Latin1_General_CP1_CI_AS".
> > My SQL server and model databases are in the collation named "
> > Latin_General_BIN".
> >
> > I though that if we didn't mention the collation for [Order] column, it
> will
> > take the database collation as default.
> > But i got the error as "Cannot resolve collation conflict for equal to
> > operation.".
> >
> > It is working fine when i use explicitly collation as follows.
> > DECLARE @Order_Numbers_Table TABLE
> > (
> > [Serial] INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
> > [Order] CHAR(11) COLLATE SQL_Latin1_General_CP1_CI_AS
> > )
> >
> > How can i write the generalized procs to create on any databases
> > irrespective of its collations?
> >
> > Thanks,
> > Vijay
> >
> >
>
>
- Next message: Peter: "Re: How to create a table with many same type fields by coding?"
- Previous message: Andy Phillips: "auto backup and restore"
- In reply to: Adam Machanic: "Re: Using "Table" variable"
- Next in thread: Hugo Kornelis: "Re: Using "Table" variable"
- Reply: Hugo Kornelis: "Re: Using "Table" variable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|