Re: Variable server names
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Mon, 6 Jul 2009 22:35:01 +0000 (UTC)
Rick (rick0726@xxxxxxxxxxx) writes:
THANK YOU. I can't use a regular '#' temp table because the proc is
being run by BCP in order to send its output to a text file, and BCP
can't see '#' temp tables.
Well, you can use INSERT-EXEC to get data to the temp table, and
then copy the data to a table variable. Or, hum, maybe not, because BCP
is likely to get an error on the temp table.
Then again, this plainly bizarre kludge may work for you:
DECLARE @fmtonlyon bit
SELECT @fmtonlyon = 0
IF 1 = 0 SELECT @fmtonlyon = 1
SET FMTONLY OFF
CREATE TABLE #temp (...)
IF @fmtonlyon = 1 SET FMTONLY ON
And then you use the temp table in the INSERT-EXEC, still BCP will be
happy.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- Re: Variable server names
- From: Rick
- Re: Variable server names
- References:
- Variable server names
- From: Rick
- Re: Variable server names
- From: Eric Isaacs
- Re: Variable server names
- From: Rick
- Re: Variable server names
- From: Erland Sommarskog
- Re: Variable server names
- From: Rick
- Re: Variable server names
- From: Erland Sommarskog
- Re: Variable server names
- From: Rick
- Variable server names
- Prev by Date: Re: Buckets of rows
- Next by Date: Re: createing DB of Views from a SQL server on another machine
- Previous by thread: Re: Variable server names
- Next by thread: Re: Variable server names
- Index(es):
Relevant Pages
|