Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
alecken #1
Please help! My SQL statement doesn't work..
It should be simple but this is the first time for me trying to use store
procedure, can someone help correcting my syntax? I'm trying to do some looping
in my store procedure: declare @loopnumber int declare @dbname varchar
select @loopnumber = 1 select @dbname = 'MYDB_' + CAST(@loopnumber) While
@loopnumber < 10 BEGIN /* SQL query here */ I put a create DB statement here
select @loopnumber = @loopnumber + 1 END I got error from SQL server saying
that: Server: Msg 1035, Level 15, State 10, Line 5 Incorrect syntax near
'CAST', expected 'AS'. Server: Msg 170, Level 15, State 1, Line 11 Line 11:
Incorrect syntax near '@dbname'. The strange thing is, when I run this query,
1 database get created despite of the error and it is not looping as expected.
The database name supposed to be MYDB_1, MYDB_2 etc instead I got 1 complete
database with all the tables created but the name of the new database is
@dbname How can I make this loop work? it seems so simple, I've check SQL book
and I have no syntax error as far as looping What I'm not sure of is how to
convert numeric datatype to nvarchar, is using CAST( ) not allowed? Please
help!!!!!!
alecken Guest
-
Problem getting sql statement logging to work
Hi I am trying to log my sql statements to the syslog file. I have the following entries in my postgresql.conf file yet it doesn't seem to log... -
Links don't work in Shockwave movie but work in p
Hi, everyone: I encountered a strange problem. I downloaded a sample movie from Macromedia site and noticed that the same problem occurs what I had... -
Simple PHP & MySQL Insert Statement Does Not Work
Hello, I'm having a bear of a time figuring out why a simple PHP/MySQL insert is causing a parse error when trying to insert static data, and no... -
if statement does not work ?
An insignificant noise sounding like Sandwick said: Replace the two if statement lines with the one line below $color == "#fffe10" ? $color =... -
dmuniz #2
Re: Please help! My SQL statement doesn't work..
I am not to familiar with MY SQL but in SQL Server the problem would be that
the line select @dbname = 'MYDB_' + CAST(@loopnumber) should be select
@dbname = 'MYDB_' + CAST(@loopnumber as varchar(20)) The following should work
as well select @dbname = 'MYDB_' + CAST(@loopnumber as varchar)
dmuniz Guest



Reply With Quote

