Hi, I'm sorry, using parameters is just not supported in this case. What you could do is: create a custom Java function (CREATE ALIAS ...) where you can can pass parameters, and where you can create and execute the SQL statement.
Regards, Thomas On Thu, Feb 12, 2009 at 10:58 AM, t603 <[email protected]> wrote: > > Hello, > > I have a problem. I want to create many linked tables to MS SQL Server > 2005, where I want to define source as quite complex select in MS SQL > Server 2005. I want to pass parameters to CREATE LINKED TABLE as > string variables. But it does not work for me. I do it in following > way: > > set @driver = 'net.sourceforge.jtds.jdbc.Driver'; > set @url = 'jdbc:jtds:sqlserver://myServer:1433/ > myDatabase;domain=myDomain'; > set @username = 'myUsername'; > set @password = 'myPassword'; > set @sqlCommand = 'myTable'; > > CREATE LOCAL TEMPORARY LINKED TABLE IF NOT EXISTS TEST2 (@driver, > @url, @username, @password, @sqlCommand) READONLY; > > Following error appears: > > Error: Syntax error in SQL statement CREATE LOCAL TEMPORARY LINKED > TABLE IF NOT EXISTS TEST2 (@DRIVER,[*] @URL, @USERNAME, @PASSWORD, > @SQLCOMMAND) READONLY ; expected string; SQL statement: > CREATE LOCAL TEMPORARY LINKED TABLE IF NOT EXISTS TEST2 (@driver, > @url, @username, @password, @sqlCommand) READONLY [42001-107] > SQLState: 42001 > ErrorCode: 42001 > Error occured in: > CREATE LOCAL TEMPORARY LINKED TABLE IF NOT EXISTS TEST2 (@driver, > @url, @username, @password, @sqlCommand) READONLY > > What I am doing wrong? Next I want to have @sqlCommand containing > select like > > set @sqlCommand = '(select top 10 *, ''hi'' from myTable)'--containing > apostrophes > > Thank You in advance for Your help. Stepan > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
