Thursday, March 3, 2011

MS SQL 2000 - Parameters in DTSRUN using xp_cmdshell

I am running the following: master..xp_cmdshell 'dtsrun /S ricmssql02 /U admindw /P letmein /N "scott - debug"' but also send parameters. I am seeing the following to do that: /A global_parameter_name:typeid=value And also that the whole thing can be repeated to send multiple. My questions are; What is the delimiter for multiple? What are the values for typeid or do I even need it?

From stackoverflow
  • Although DTSRUN will usually work without it, the values for typeid are as follows:

    Data type Type ID
    -----------------
    Integer (small) 2
    Integer 3
    Real (4-byte) 4
    Real (8-byte) 5
    Currency 6
    Date 7
    String 8
    Boolean 11
    Decimal 14
    Integer (1-byte) 16
    Unsigned int (1-byte) 17
    Unsigned int (2-byte) 18
    Unsigned int (4-byte) 19
    Integer (8-byte) 20
    Unsigned int (8-byte) 21
    Int 22
    Unsigned int 23
    HRESULT 25
    Pointer 26
    LPSTR 30
    LPWSTR 31
    

    I'm not sure what you mean by "delimiter for multiple" - you need to have an /A for each variable you want to replace. So, if you wanted to set three string variables in your example:

    master..xp_cmdshell 'dtsrun /S ricmssql02 /U admindw /P letmein /N "scott - debug" /A "param1:8=string 1" /A "param2:8=string 2" /A "param3:8=string 3"'
    

0 comments:

Post a Comment