Re: Could anyone help how to convert the variables to appropriate data

From: Louis Davidson (dr_dontspamme_sql_at_hotmail.com)
Date: 11/15/04


Date: Mon, 15 Nov 2004 13:09:01 -0600

Can you post the entire code before the SET statement? This is not really
enough to go on.

-- 
----------------------------------------------------------------------------
Louis Davidson - drsql@hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design - 
http://www.apress.com/book/bookDisplay.html?bID=266
Note: Please reply to the newsgroups only unless you are interested in 
consulting services.  All other replies may be ignored :)
"SMV" <SMV@discussions.microsoft.com> wrote in message 
news:499091AD-C8BD-4F5E-82B8-7EE40CA91D99@microsoft.com...
> Hi all,
> In this following code, I am getting an error as
> Syntax error converting the nvarchar value
> @nvchrEventType
>
> Syntax error near @sintEventYear ,it is a bit datatype.
>
> Could anyone help how to convert the variables to appropriate datatypes in
> the table.
>
>      Begin
>
>        declare @cysql2 nvarchar(4000)
>         set @cysql2 = N'INSERT INTO #cykeys (subteamid, eventid)
>                               SELECT
>                                     fste.subteamid
>                                   ,fste.eventid
>                                    FROM dbo.dimsubteam AS dst
>                                    INNER JOIN #officefilters AS f ON
> dst.officeid = f.officeid
>                                    INNER JOIN dbo.factsubteam_event AS 
> fste
> ON dst.subteamid = fste.subteamid
>                                    INNER JOIN dbo.dimevent AS de ON
> fste.eventid = de.eventid
>                                    INNER JOIN dbo.GetFilteredEventTypeList
> ('+ @nvchrEventType +') AS et ON de.cwmswalkamericaevent =
> et.cwmswalkamericaevent
>                                    WHERE dst.closed = 0
>                                   AND dst.refused = 0
>                                   AND de.eventyear =  ' + @sintEventYear 
> + '
>                                  AND de.walkamericaevent = 1'
>
>         IF  @nvchrStatus = N'B'   or @nvchrStatus = N''  -- status is
> 'Confirmed +pending' or Null
>             set @cysql2 = @cysql2
>          IF @nvchrStatus = N'C' AND  @nvchrDollarAmountType  <>N'' -- 
> status is 'confirmed'
>            set  @cysql2 = @cysql2+N' AND fste.' + @nvchrSql + '  = 1' 


Relevant Pages

  • Re: I can not read a small file from NTEXT field in the database
    ... new XML datatype instead. ... Are you simply storing the contents of the XML file, ... That wouldn't be a ntext ... If you're working with SQL Server locally, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: I need some serious help
    ... Tibor Karaszi, SQL Server MVP ... > The result of a CASE need to be of the same datatype. ... Int is higher than the string datatypes, and the string 'David' cannot be converted ... > integer so you convert them to appropriate strings. ...
    (microsoft.public.sqlserver.server)
  • Re: String or binary data would be truncated
    ... I can't see why you would get that error with text datatype. ... Vyas, MVP ... If I change the query to the following it ... > Vyas, MVP (SQL Server) ...
    (microsoft.public.sqlserver.server)
  • Re: Data Type Question
    ... These must be user-defined datatypes (UDT). ... See Books Online, sp_addtype. ... base datatype for each UDT. ... Tibor Karaszi, SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Want To Read Float In Record As Is
    ... Float an real are generally referred to as "approximate" datatype. ... But you probably want to look ad NUMERIC or DECIMAL (these are identical in SQL Server). ... What I mean is that no matter what data type I use in variables ...
    (microsoft.public.sqlserver.programming)

Loading