SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 3rd, 2002, 11:55 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
Using a varible as a table name

Originally posted by : Janet (janet.miller@noaa.gov)I want to assign a table name to a variable and use the variable in the sql statement.Can someone provide me with the correct syntax to do this?Thanks!Janet

Reply With Quote
  #2  
Old January 7th, 2002, 04:10 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
Originally posted by : LosEnricos (TheDude@bananateam.nl)try something like this:"SELECT * FROM " & variable_name if you want to put in a where statement try somthing like this:"SELECT * FROM " & variable_name & " WHERE ID = "1" if this doesn't work, be more specific, and I will try againregards The Dude------------Janet at 1/3/2002 8:55:46 AMI want to assign a table name to a variable and use the variable in the sql statement.Can someone provide me with the correct syntax to do this?Thanks!Janet

Reply With Quote
  #3  
Old October 29th, 2003, 04:49 AM
beginner beginner is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 1 beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Creating table busing variable table name

I am trying to create a table using the following line of code in Java using Jdbc_Odbc bridge.
The following statement is not working:
statement.execute("create table " & tablename & " (Name char, Id number, Age number)");
I have checked with the whitespaces also but I am not able to track my mistake in syntax
Error give: operator & cannot be applied to java.lang.String,java.lang.String
tablename is variable which has the name of the table being given by the user.
Can you help me on this fast.

Thanks

Reply With Quote
  #4  
Old May 26th, 2004, 01:39 AM
artemis artemis is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 4 artemis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Just for reference, for other searchers, this works in FrontPage too. My code below

CREATE TABLE " & title & " (MyField1 varchar,MyField2 varchar)

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Using a varible as a table name


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT