Professional Web Applications Themes

newbie insert question - Microsoft SQL / MS SQL Server

after 2 hrs and all my manuals, google, and sql tutorial sites now realize this wont work INSERT INTO MyTable (F1, F2, F3) VALUES (V1, V2, V3) where v1, v2 and v3 are program variables but something like this should work INSERT INTO MyTable (F1, F2, F3) VALUES ( " _ & MyInteger & ", '" & MyText & "', #" MyDate & "#); 1. it doesn't look consistent in its use of quotes, apostrophes, and concatenating, comments? 2. looks like there are different formats for integer, text and dates, any others? 3. is this coding the same say for ...

  1. #1

    Default newbie insert question

    after 2 hrs and all my manuals, google, and sql tutorial sites now realize
    this wont work
    INSERT INTO MyTable (F1, F2, F3) VALUES (V1, V2, V3) where v1, v2 and v3 are
    program variables

    but something like this should work
    INSERT INTO MyTable (F1, F2, F3) VALUES ( " _
    & MyInteger & ", '" & MyText & "', #" MyDate & "#);

    1. it doesn't look consistent in its use of quotes, apostrophes, and
    concatenating, comments?
    2. looks like there are different formats for integer, text and dates, any
    others?
    3. is this coding the same say for access, sql server, mysql, etc
    4, any sql websites where there is good explanation of this syntax
    5, my current app is vbscript, is it all the same for vb6.0, javascript, etc


    bbxrider Guest

  2. #2

    Default Re: newbie insert question

    Your best bet is to create a stored procedure with the 3 parameters defined
    with the proper datatypes. Then you can simply use this in your sp.

    INSERT INTO MyTable (F1, F2, F3) VALUES (V1, V2, V3)

    There are many advantages to calling a sp vs trying to build a string to
    execute on the front end.

    --

    Andrew J. Kelly
    SQL Server MVP


    "bbxrider" <net> wrote in message
    news:udp%phx.gbl... 
    are 
    etc 


    Andrew Guest

  3. #3

    Default Re: newbie insert question

    thanks for the tip,
    "Andrew J. Kelly" <com> wrote in message
    news:#phx.gbl... 
    defined [/ref]
    realize 
    > are [/ref]
    any 
    > etc 
    >
    >[/ref]


    bbxrider Guest

Similar Threads

  1. Newbie..how to insert a flash object
    By PhilAJ in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: October 19th, 07:30 PM
  2. Insert Object Extension (?) Help for Newbie
    By maynardjarvis in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 3
    Last Post: July 18th, 08:53 PM
  3. Newbie: Insert Into Partially Working
    By jmeredith in forum Coldfusion Database Access
    Replies: 2
    Last Post: December 4th, 06:24 PM
  4. Replies: 5
    Last Post: December 3rd, 10:44 AM
  5. Insert page error (asp newbie)
    By Amiddlet webforumsuser@macromedia.com in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: September 28th, 07:51 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139