sql - How to return table name with columns in select query -
My database has a stored procedure. In that archived process, I am retrieving data from ten different tables. The result I am getting 10 tables. My question is, is there any way, so I can return the name of the table. Because this SP is executing with my vb.net project and storing this result in a dataset. And I have this stored procedure, which tables up to tables in my data set from this stored function. So I'm merging this table as Dataset 1 WTL ("Table 1"). (Merge (dataset2.tables (0))
Now I want to do this, I have to give the name of the table to get results from the stored process, so that I have a table name with table table (0)
Then I should retrieve the results like this stored procedure.
I'm storing the process like
> proc sp_QM_INVOICE_MATBATCHWISE_DETAILS @PLANT_CODE NUMERIC (5,0), @COMPANY_CODE NUMERIC (5,0), @ FEER NUMERIC (5,0), @STRAN SIA Start as QC VARCHAR (15), @SMOE VARCHAR (5), @DOC_OVARCHAR (20), @INVOICE_NOVARCHAR (20), @CUSTOMER_NO VARCHAR (20) * QM_INVOICEMATWISE_DETAILS WHERE COMPANY_CODE = @ COMPANY_CODE and PLANT_CODE = @ PLANT_CODE And select FYEAR = @ FYEAR and DOC_NO = @ DOC_NO and INVOICE_NO = @ INVOICE_NO and CUSTOMER_NO = @Customer Select * QM_INVOICEMATBATCHWISE_DETAILS WHERE COMPANY_CODE = COMPANY_CODE and PLANT_CODE = @ PLANT_CODE and FYEAR = @ FYEAR and DOC_NO = @ DOC_NO and INVOICE_NO = @ INVOICE_NO And CUSTOMER_NO = @Customer Select * from QM_TESTCERTIFICATEFORMATCUST_T WHERE COMPANY_CODE = @ COMPANY_CODE and PLANT_CODE = @ PLANT_CODE and FYEAR = @ FYEAR and DOC_NO = @ DOC_NO and INVOICE_NO = @ INVOICE_NO and CUSTOMER_NO = @Customer and
So how can I get this result with the table name in the result when I execute this archived process through my code, then I am retrieving this result in a data set. In the data set, tables are similar to Table 1, Table 2, Table 3. So how can I get the result, but with the table name stored through the stored procedure
< P>
UPDATE
As you would like to refer to bunch o tables by name Not, you need to set up each table (field TableName
) to read the first line and the properties of each dataset TableName
.
After calling the process, you should run:
Tables for each TBL in Dataset 1. Ro.kount & gt; 0 tbl.TableName = tbl.Rows (0) ("TableName") End if next
You can reference them as dataset1.tables ("QM_TESTCERTIFICATEFORMATCUST_T") Will be
, for example.
As you know that you are referring them into the processed process, you can hardly write the names of tables in vb.net and avoid empty posts which are empty table Will be in the case of
Comments
Post a Comment