General discussion

  • Creator
    Topic
  • #2103032

    Dynamic Views in MSSQL Server

    Locked

    by shibu ·

    MS-SQLServer provides varchar datatype of maximum size 8000 characters. The problem I am facing is that I am creating a dynamic view whose statements runs more than 8000 characters and I am not able to hold more than 8000 characters in a local variable whose data type is varchar(8000). SQL Server does not allow TEXT datatype as local variable which if allowed would solve the problem.How do I generate a dynamic view which is more that 8000 characters?

All Comments

  • Author
    Replies
    • #3689987

      Dynamic Views in MSSQL Server

      by glen_mcleod ·

      In reply to Dynamic Views in MSSQL Server

      Try putting each of your clauses in separate variables then executing them as a unit.

      Exec (@SelectClause + @FromClause + @WhereClause + @GroupByClause + @OrderByClause + @HavingClause)

      I’ve never done it with something as big as what you describe, but this is relatively simple and worth a try.

      Glen

    • #3481592

      Dynamic Views in MSSQL Server

      by jereg ·

      In reply to Dynamic Views in MSSQL Server

      Upgrade to new version.

Viewing 1 reply thread