Page 1 of 1
passing Record into Table valued parameters
Posted: Mon 28 May 2012 12:30
by hmdsadeghian
Hi everybody.
How can i pass record type into table valued parameters with TStoredproc?
I'm using SDAC 6.1.4 for Delphi XE2.
Thanks
Re: passing Record into Table valued parameters
Posted: Tue 29 May 2012 09:10
by AndreyZ
Hello,
Please read the "Using Table-Valued Parameters" article of the SDAC documentation. It describes the way of using the TMSStoredProc component to work with Table-Valued Parameters.
Re: passing Record into Table valued parameters
Posted: Fri 21 Dec 2012 07:27
by Lithiumâ„¢
Hello, AndreyZ.
Do I have to install every time new version of SDAC to refresh last documentation? Is there any way to download latest documentation without reinstalling?
Thanks.
Re: passing Record into Table valued parameters
Posted: Fri 21 Dec 2012 09:00
by AndreyZ
You can download the latest version of the SDAC documentation in the CHM and PDF formats at
http://www.devart.com/sdac/download.html
Re: passing Record into Table valued parameters
Posted: Fri 21 Dec 2012 10:14
by Lithiumâ„¢
I've got it.
Code: Select all
MSTableData.TableTypeName := 'DeptTableType';
MSTableData.Open;
MSTableData.Append;
MSTableData.Fields[0].AsString := 'ACCOUNTING';
MSTableData.Fields[1].AsString := 'NEW YORK';
MSTableData.Post;
MSStoredProc.StoredProcName := 'SP_InsertDept';
MSStoredProc.PrepareSQL;
MSStoredProc.ParamByName('TVP').AsTable := MSTableData.Table;
MSStoredProc.ExecProc;
MSTableData.Close;
If a stored procedure requires two or more table-valued parameters, should I create and open several TMSTableData instances for each of them?
Re: passing Record into Table valued parameters
Posted: Fri 21 Dec 2012 12:06
by AndreyZ
If a stored procedure requires two or more table-valued parameters, should I create and open several TMSTableData instances for each of them?
Yes.
Re: passing Record into Table valued parameters
Posted: Wed 11 Sep 2013 18:55
by hmdsadeghian
Hi again.
I'm using TMSTABLEDATA to work with Table-Valued parameter .
When i click on the TableTypeName Drop Down,i get the error "Table Valued parameter is not supported by SQL Server" .
If typing Table-Valued Parameter name in the TableTypeName and avtice the connection,i get the error "Table Does not Exist".
I'm using Delphi 2010 And SQL Server 2012.
Sdac Version is = 6.7.14
Thanks for Advance.
Re: passing Record into Table valued parameters
Posted: Thu 12 Sep 2013 09:46
by AndreyZ
Table-Valued Parameters are supported since SQL Server 2008 and only using SQL Native Client 10 or higher. As you are using SQL Server 2012, the problem occurs because you are using not the correct version of the provider. To solve the problem, you should set the TMSConnection.Options.Provider property to prAuto or prNativeClient. Also, make sure you have SQL Native Client 10 or 11 installed on your computer.
Re: passing Record into Table valued parameters
Posted: Thu 12 Sep 2013 11:28
by hmdsadeghian
Thanks.
Re: passing Record into Table valued parameters
Posted: Thu 12 Sep 2013 12:13
by AndreyZ
If any other questions come up, please contact us.