SQL query SIZE

  • I have a sql query which produces the size more than varchar (8000)/max size. So my stored procedure get crashes. Can any one help me to work around with this problem, I greatly apprecaite it.

     

    DECLARE @sql varchar(8000)   -- The maximum limit of varchar 8000

    //My @sql query goes here

    EXEC (@sql) //crashes

     

     

     

     

  • DECLARE @sSQLSELECT VARCHAR(8000)

    DECLARE @sSQLFROM VARCHAR(8000)

    DECLARE @sSQLWHERE VARCHAR(8000)

    SET @sSQLSELECT='SELECT .......'

    etc

     

    EXEC( @sSQLSELECT + @sSQLFROM + @sSQLWHERE)

  • Thanks David. Appreciate.

    raj

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

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