Dynamic Rows and columns

I host a sql statement in a table column/row which is going to be used in a report. When I call this sql statement it is something like this

DECLARE @statemnt

set @statemnt = select t VAL_SQL from T_VALIDATIONS

exec (@statemnt )

Here are two examples of VAL_SQL

 SELECT [EmployeeID]
   FROM [AdventureWorks].[HumanResources].[Employee]
 for row 2 = 
 SELECT  [VendorID]
   FROM [AdventureWorks].[Purchasing].[Vendor]

Now i need to put the statement into a set of rows and columns which dynamically get generated at runtime.

Row 1 could contain a statemnt which generates 15 columns

Row 2 could generate a result of 8 columns... all depending on what is in the val_sql

can anyone asist with a row_number or pivot statement to assist? The statement should have 3 attributes - Rows, Columns, Values in order to place in a matrix report (ssrs)

more ▼

asked May 10, 2013 at 05:46 AM in Default

avatar image

1k 82 88 93

(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: May 10, 2013 at 05:46 AM

Seen: 662 times

Last Updated: May 12, 2013 at 03:54 PM

Copyright 2018 Redgate Software. Privacy Policy