Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post

    Why doesn't this work

    if I do something like this it creates the table

    SQLmkTbl = "CREATE TABLE CompanyInfo (First_Name VARCHAR(20), Last_Name VARCHAR(30), Company VARCHAR(60) )"

    this will create a table called "CompanyInfo", but if I write this

    SQLmkTbl = "CREATE TABLE '"& sname &"' (First_Name VARCHAR(20), Last_Name VARCHAR(30), Company VARCHAR(60) )"

    where sname is an ASP variable I get nothing, no error, no table, no nothing. I've tested the variable with a response.write statement and it worked great but not in the SQL statement. All help is appreciated, thanks.
    I would rather be a lion for a day than a lamb that lives forever.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you execute the SQL Statement? i.e.:

    conn.execute(SQLmkTbl)

    Usually it's simple stuff like that which is overlooked.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Response.write your SQL statements and make sure they are the exact same. It looks like you have apostrophes around sname in the second statement.

    Code:
    SQLmkTbl = "CREATE TABLE "& sname &" (First_Name VARCHAR(20), Last_Name VARCHAR(30), Company VARCHAR(60) )"

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks, from the suggestions above I got it to work.
    I would rather be a lion for a day than a lamb that lives forever.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •