db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bailey, David" <David.Bai...@pearson.com>
Subject Use variables in SQL script?
Date Fri, 24 Jun 2011 19:17:33 GMT
I'm considering Derby as one of several possible replacement databases
for a product of ours currently running on Microsoft's SQL Server
Express.  As part of the evaluation process, I am trying to build a
Derby database using existing SQL scripts we have which use T-SQL
dialect.  Obviously, I need to make changes here or there to get the
scripts to run in the Derby dialect.
 
One thing I am having a great deal of difficulty with is the following.
In T-SQL, it is possible to define variables within an SQL script as
follows:
 
    DECLARE @myvar int;
    SET @myvar = 100;
 
And for the rest of my script, T-SQL will make the appropriate
substitution whenever it encounters the string '@myvar'.  Derby appears
not to like the '@' symbol.
 
I'm assuming the Derby dialect supports this sort of variable
declaration, but I'm having a hard time hitting on the proper syntax,
and I'm having just as much difficulty finding any useful information in
the documentation or online.  Can someone explain to me how this works?
 

David Bailey

Software Developer
Assessment & Information 
Pearson

D: (952) 681-3890


Pearson 

Always Learning
Learn more at www.pearsonassessments.com


 

Mime
View raw message