Re: Are you guys sure about '+' in this sp

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Adam Machanic (amachanic_at_air-worldwide.nospamallowed.com)
Date: 03/24/04


Date: Wed, 24 Mar 2004 17:08:29 -0500

Chris,

You're still not evaluating that SQL; all you're doing is preparing the
string. You need to EXECUTE it.

"Chris" <anonymous@discussions.microsoft.com> wrote in message
news:A1A25FC9-8B12-4757-ADE5-C49AD3266A81@microsoft.com...
> Hi,
> This is a sample
>
>
> create procedure testing(
> @storeID varchar(10),
> @productNumber varchar(10),
> @coverDate varchar(10),
> @strSQL INT(10) OUTPUT
>
> )
> AS
>
>
>
> select @strSQL = 'SELECT sum(quantity + overage - notdeliv - short -
damaged) from OPENQUERY(PROGLINK,' + '''select
quantity,overage,notdeliv,short,damaged
> from history where id =' + (@storeID) + 'and number =' +
(@productNumber) + ' and cover-date =' + (@coverDate) + '''' + ')'
>
>
> return @strSQL
>
>
> I need the value returned to be integer. Presently Iget an error
>
> Server: Msg 2716, Level 16, State 1, Procedure testing, Line 0
> Column or parameter #4: Cannot specify a column width on data type int.
> Parameter '@strSQL' has an invalid data type.
>



Relevant Pages

  • RE: SQL Server not inserting all rows from single long statement
    ... >From Books Online explaination of EXECUTE: ... or nvarchar data type with a maximum value of the server's available ... characters for char or varchar data type strings. ... If the string is greater ...
    (microsoft.public.sqlserver.server)
  • verifying data type
    ... I want my code to look at the contents of a cell, and if the contents are not ... a number (any string) execute one set of code. ... but I don't know how to test the data type of the ...
    (microsoft.public.excel.programming)
  • Re: Array Or what?
    ... > I'd like to select some rows from SQL Server table. ... > What data type for a parameter in VB should I use. ... statement around it into a larger string and then use the EXECUTE ...
    (microsoft.public.vb.general.discussion)
  • Re: New to Classes, please help.
    ... David Lozzi ... > A class is a data type, just as an integer or a string. ... >>> example, username dlozzi, password fun. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: [1/1][PATCH] nproc v2: netlink access to /proc information
    ... Nproc, on the other hand, uses field IDs to identify information. ... Data type ID ... For strings, the string itself is prepended with a u32 indicating the ... the kernel suggests "VmShared" as a label, "%8u" for formatting, ...
    (Linux-Kernel)