Where are these trailing spaces coming from?

  • Posted - 11/20/2009 : 15:44:44

    I am moving a database to a new server.

    Old: SQL 7 on Win Server 2k

    New: SQL 2008 on Win Server 2008

    My vb.net app fills the datagridview with a stored procedure.

    Profiler for each as follows (only the connection string is changed on the app side):

    Old: exec bb2_SearchSalesHist;1 0.5, 1, 6, '%', '%', '%', '%'

    New: exec bb2_SearchSalesHist;1 0.5, 1, 6, '% ', '% ', '% ', '% '

    The stored procedure starts out like so:

    CREATE PROCEDURE bb2_SearchSalesHist

    @diam decimal(9,4),

    @diam2 decimal(9,4),

    @length decimal(9,4),

    @pitch varchar(10) ,

    @head varchar(2),

    @grade varchar(10),

    @Cust varchar(5)

    Where are those spaces coming from?

  • I'm going to venture a guess it is an ANSI_PADDING issue. Try this query on th 2008 box:

    SELECT

    DATABASEPROPERTYEX('Personnel', 'IsAnsiPaddingEnabled ') AS DB_ANSI_PADDING,

    [ansi_padding] AS Connection_ANSI_PADDING,

    session_id,

    login_time,

    [host_name],

    program_name,

    client_version,

    client_interface_name,

    login_name,

    nt_domain,

    nt_user_name,

    status,

    context_info

    FROM

    sys.dm_exec_sessions AS DES

    FInd your connection and see what the settings are. In 2000 (works in 2008 too) you get this information for the connection from Profiler using the Sessions:ExistingConnection event. I don't know of anywhere else to get it.

Viewing 2 posts - 1 through 2 (of 2 total)

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