Urget help needed on Execute SQL Task

  • Hi pals,

    I need small help.

    I have a execute SQL task in which i have a delete statement with global params.

    delete from where (strval=?) and (year=?)

    both are varchar type variables.

    my strval column gets a value something like "DecData1.0". But when i ran my DTS package it is ignoring this SQL statement. Might because of the special char '.' in "DecData1.0".

    How to handle such situation.

    I also tried by putting a single quote.

    delete from where (strval='?') and (year=?)

    But it is giving an error.

    Any suggestions will be a great help.

    Thanks in advance,

    franky

  • Your first example was correct, should be something like:

    delete from TableName where (strval=?) and (year=?)

    Perhaps your parameters are mapped incorrectly? For example -

    Variable Name Direction DataType ParameterName

    User::strVal Input nvarchar 0

    User::Year Input nvarchar 1

  • The params are perfectly alright. All are VARCHAR datatype. Do i need to choose nvarchar?

  • Use nvarchar for the parameter datatype. I was able to reproduce this without error using the settings above. The table I used to test it out on -

    create table blah

    (strval varchar(100),[year] varchar(100))

    insert into blah (strval,[year])

    values ('DecData1.0','2007')

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply