stored procedure problem

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #41

    Default Re: stored procedure problem

    Originally posted by: philh


    mvlistvar = "''myvar1'',''myvar2'',''myvar3''"
    Pay very close attention to the number and type of quotes here.




    Remember when I said that? There are consecutive single quotes in that
    string. The only double quotes are at the start and finish. Copy and paste it
    into Query Analyzer and you'll see the way this should look.

    philh Guest

  2. Similar Questions and Discussions

    1. MSSQL Stored Procedure Problem
      I am trying to pass some variables into a MSSQL stored procedure and for some reason it is truncating the last variable. If I move the order of the...
    2. Problem building stored procedure
      Hello , I am using DB2 7.2 Personal Edition on Windows NT Workstation 4.0. I need to write stored procedures for DB2. I have installed Application...
    3. ADO/Stored Procedure Problem
      After creating a new recordset and setting the cursor type to AdOpenStatic, I call a stored procedure thru the recordset's Open() method, and the...
    4. Stored Procedure/Parameter problem
      I'm getting an error I don't understand.... Here's my Code: Dim dr As SqlDataReader Dim retVal As Boolean = False Dim MySQL as string =...
    5. Problem with DBMS_JOB within a stored procedure
      Hello- I've done a fair amount of searching on this topic and haven't found exactly what i'm looking for. At the most simple level, I'm calling...
  3. #42

    Default Re: stored procedure problem

    I did use the two single quotes inside a double quoted string, and here is what
    I get from the query analyzer:


    Insert into #tempreport (app,prev_app,cert,basin,file_dt,app_status,source ,
    pod_qq,pod_q,pod_sec,pod_twn,pod_rng,div_balance,m ou,pou_acre_total,
    duty_balance,duty_unit,county,owner_name)
    SELECT dbo.main_src.app, dbo.prevapp.prev_app, dbo.main_src.cert,
    dbo.main_src.basin, dbo.main_src.file_dt, dbo.main_src.app_status,
    dbo.main_src.source, dbo.main_src.pod_qq,
    dbo.main_src.pod_q, dbo.main_src.pod_sec, dbo.main_src.pod_twn,
    dbo.main_src.pod_rng,
    dbo.main_src.div_balance, dbo.main_src.mou,
    dbo.main_src.pou_acre_total, dbo.main_src.duty_balance,
    dbo.main_src.duty_unit, dbo.main_src.county,
    MIN(dbo.owner.owner_name) AS owner_name
    FROM dbo.main_src LEFT OUTER JOIN
    dbo.owner ON dbo.main_src.app = dbo.owner.app LEFT OUTER
    JOIN

    dbo.prevapp ON dbo.main_src.app = dbo.prevapp.app
    WHERE (dbo.owner.owner_type IN ("b","c")) AND
    ( f_basin IS NULL OR dbo.main_src.basin IN(''007'',''006''))
    GROUP BY dbo.main_src.app, dbo.main_src.cert, dbo.main_src.app_status,
    dbo.main_src.basin, dbo.main_src.county, dbo.main_src.source,
    dbo.main_src.pod_qq, dbo.main_src.pod_q,
    dbo.main_src.pod_sec, dbo.main_src.pod_twn, dbo.main_src.pod_rng,
    dbo.main_src.duty_balance,
    dbo.main_src.duty_unit, dbo.main_src.div_balance,
    dbo.main_src.mou, dbo.main_src.pou_acre_total, dbo.main_src.file_dt,
    dbo.prevapp.prev_app
    Server: Msg 170, Level 15, State 1, Line 12
    Line 12: Incorrect syntax near '007'.

    Manweevil Guest

  4. #43

    Default Re: stored procedure problem

    I don't understand how you're using double quote marks in T-SQL. You should
    use single quote marks to delimit strings.

    Try this sample code (cut and paste into Query Analyzer)

    declare @mySQLstring varchar(8000)
    declare @l_vmyPassedVariable varchar(128)
    set @l_vmyPassedVariable = '''107'',''108'''
    set @mySQLString =
    'SELECT *
    FROM some_table
    WHERE (@some_var IS NULL OR dbo.some_table.some_var IN
    ('+@l_vmyPassedVariable+'))'
    print @mySQLString
    --exec(@mySQLString)

    This is the model your code should follow to work correctly.

    HTH,

    philh Guest

Posting Permissions

  • You may not post new threads
  • You may 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