[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Creating temp table in SQL Server



It's simple:  you use two ## symbols.  As you noticed, SQR thinks one #
symbol means you want to reference a numeric variable.  You simply have to
use two.

BTW, you'll also find you need to create your temp table in the setup
paragraph if you intend to use the table in a Begin-Select paragraph.
Also, you might find it necessary to use the -Cn parameter on the Begin-SQL
and Begin-Select paragraphs, depending on the complexity of your program.

Good luck,
Tim Green
ADP, Inc




"Shaver, Richard H" <richard.h.shaver@LMCO.COM>@list.iex.net> on 10/19/99
09:24:38 AM

Please respond to SQR-USERS@list.iex.net

Sent by:  "Discussion of SQR, SQRIBE Technologies's database reporting
      language" <SQR-USERS@list.iex.net>


To:   Multiple recipients of list SQR-USERS <SQR-USERS@list.iex.net>
cc:
Subject:  Creating temp table in SQL Server


I can't seem to find the right syntax to create a temporary table in SQL
Server using SQR.  SQL Server builds temporary tables when the table name
is
preceded by a #.  It is simple enough to do within the database using the
native language (i.e. CREATE #TEMP (FIELD TYPE), but when I try to use the
same syntax in SQR I receive the "COUNT field incorrect" error.  If I put
brackets around the table name, i.e. CREATE [#TEMP], SQR returns the
"incorrect syntax near [" error.  (I got the idea for the brackets from the
SQR Users group page, but it was in regards to Informix.)

I have tried the Create command and the Select * Into command with the same
results.


begin-program
  begin-sql
    create table #rick (test char(4))
  end-sql
end-program


begin-program
  begin-sql
    select * into [#rick] from srsch
  end-sql
end-program


The same SQR syntax creates a permanent table if I remove the # from in
front of the table name, but that sort of defeats the purpose.  Any ideas??

tia
Rick Shaver
LM Data Systems
1-360.396.8488