Home Forums SQL Server 2005 T-SQL (SS2K5) sp_executesql : Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'. RE: sp_executesql : Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.

  • you can use exec, since you're not passing parameters in or out of the dynamic SQL

    CREATE procedure Search

    (

    @SearchKeyword Varchar(2000),

    @Productid varchar(2000),

    @Type varchar(200),

    @SQLPerms varchar(5000)

    )

    as

    Declare @SQL varchar(7000)

    set @SQL=' This Statement length goes more than 4000.'

    exec (@SQL)

    GO

    Make sure you're checking for SQL injection attempts.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass