Re: [firebird-support] Re: INSERT INTO ... RETURNING with EXECUTE STATEMENT

2014-06-24 Thread Tim Ward t...@telensa.com [firebird-support]
On 23/06/2014 13:12, Dmitry Yemanov dim...@users.sourceforge.net 
[firebird-support] wrote:


23.06.2014 14:48, Tim Ward t...@telensa.com [firebird-support] wrote:

 I've got an INSERT statement like:

 INSERT INTO table( list of columns )
 SELECT list of columns
 FROM table whose name is not known until run time
 WHERE something
 RETURNING generated_primary_key INTO :variable

 the point being that the name of the table used in the FROM isn't known
 until run time. This needs to be inside a stored procedure for 
Firebird 2.1.


 Elsewhere (simple SELECT, FOR SELECT) I've worked out how to do this
 using EXECUTE STATEMENT.

 But what, please, is the correct syntax for using EXECUTE STATEMENT for
 an INSERT INTO ... SELECT ... RETURNING? - this isn't an example usage
 which I've been able to find in any of the documentation.

I believe it should be:

EXECUTE STATEMENT 'INSERT INTO ... SELECT ... RETURNING
generated_primary_key' INTO :variable;

Dmitry


The procedure does compile, but when I run it I get

request synchronization error

at that statement.

--
Tim Ward



[firebird-support] Cannot Insert Filepath into database

2014-06-24 Thread 'Simon Gallitscher' adun...@gmx.de [firebird-support]













Re: [firebird-support] Cannot Insert Filepath into database

2014-06-24 Thread Helen Borrie hele...@iinet.net.au [firebird-support]
Hello Simon,

At 11:00 p.m. 24/06/2014, 'Simon Gallitscher' adun...@gmx.de [firebird-support] 
wrote:
 
I'm trying to insert a filename into my database using a .net firebird 
connector.
Unfortunatly the standard escape character '\' is not working.
When i'm trying to insert a path like this: C:\\etc\\files\\text1.txt i'm 
getting a erro tellign emt hat the column count doe snot match the value count.
I have compared the count many times and i'm pretty sure the error is related 
to none-workign escape characters.
 

It's not exactly clear what you mean by insert a filename into my database.  
A file name (or path) as *data* would need to be stored as a string.  Strings 
in SQL are delimited by the apostrophe character, aka single quotes.  The 
backslash character is not an escape character in SQL. 

If you are talking about an INSERT statement then the syntax would be 

INSERT INTO MYTABLE ( {some other fields}, FILEPATH) 
VALUES ( {some other values}, 'C:\etc\files\text1.txt')

Note, if you have to escape an apostrophe within the string, the escape 
character is also an apostrophe.  We sometimes refer to that as doubling the 
apostrophe.

If you are talking about something different, specific to the .NET connector, 
this is not the right place to ask.  You should subscribe to the 
firebird-net-provider list and ask there:
List-Subscribe:mailto:firebird-net-provider-requ...@lists.sourceforge.net?subject=subscribe



Helen Borrie, Support Consultant, IBPhoenix (Pacific)
Author of The Firebird Book and The Firebird Book Second Edition
http://www.firebird-books.net
__