Is there any way to add more stored procedure schema in existing one in BizTalk? - schema

I have one stored procedure schema which one has 3 stored procedures combined as below SS:
Now I want to add one more stored procedure schema in above Dest_Procedure.dbo.xsd

Related

Moving multiple table data from one database to another database by stored procedure using SSIS packages

I have a stored procedure which gets data from table trans of database "A" and inserts into multiple tables (trans, trans_log, trans_history) in database "B" and then this procedure just deletes that data from the trans table in database "A". This is just an archive process. The procedure RETURNs 0 if successful.
Previously it was scheduled as a SQL job, but now I need to create an SSIS package for it. How to create SSIS package for this? I know that I need to create source and destination connection in a dataflow, but I am stuck at mapping columns, my procedure does not any return columns it just inserts into multiple table of another database.
How do I define source and destination or how do I perform this in SSIS package?

Stored procedure with global table

Is there any difference between stored procedure which uses global temporary table and one which does not in MS SQL database?
Global temporary table's scope is not limited to stored procedure, it can conflict with other procedures using same global temporary table(##TableName)
You can create Global temporary table in procedure, insert data and then see your data after store procedure execution.

using stored procedure to connect to db in external server

I have a stored procedure that updates a table taking the data from a source and I want to modify the stored procedure so that it takes data from a table in an external database and updates a table in the original server. Can this be achieved and how ?
See linked servers, it's treated just a synonym: http://msdn.microsoft.com/en-us/library/ff772782.aspx
Actually synonyms are treated like linked servers..

Where is #Temp Stored ? OR How is #temp Stored

I know #temp is temp. Table valid for particular session only. but if i define #temp in two different session, and run them simultaneously will that conflict. if no then how actually these tables are stored in memory. And how is that different from ##Temp?????
Temporary tables with a single # are "local", while those with a double ## are "global".
Local ones will drop out of scope once the stored procedure that defines them is done.
Global ones can be used by other users, or by the same user from different stored procedures, or by multiple calls of the same procedure. They will get dropped only after the last user that was referencing them is no longer referencing them, i.e. after the last stored proc is complete.
All are stored in the tempdb database; none in the "memory".
From CREATE TABLE
The full name of a temporary table as stored in the sysobjects table
in tempdb is made up of the table name specified in the CREATE TABLE
statement and the system-generated numeric suffix.
So it is stored in the tempdb.
Also from Temporary Tables in SQL Server
Temporary tables and table variables are created in the TempDB
database

how to access the temporary table created inside stored procedure [vb6]

I have a stored procedure inside which I am creating a temporary table.
My vb code will execute this stored procedure.
Is it possible to access the data in the temp table in vb6 after sp execution?
Use a global scope temporary table (they start with ## rather than #). These are shared between sessions. They go out of scope when the session that created them ends AND no other session is referring to them.
Temporary Tables in SQL Server
Creating and Modifying Table Basics
SQL Server 2005 and temporary table scope
Another option is a persistent temporary table (prefixed by TempDB..)
From Books Online:
A local temporary table created in a stored procedure is dropped
automatically when the stored procedure is finished. The table can be
referenced by any nested stored procedures executed by the stored
procedure that created the table. The table cannot be referenced by
the process that called the stored procedure that created the table.
A temporary table created within a Stored Procedure is dropped when the Stored Procedure ends, so the answer is no.
If you really want to share a temporary table with the caller, you could do something like the following:
Conditionally create the temporary table in your Stored Procedure if it doesn't already exist
CREATE PROCEDURE MyProcedure AS
...
if object_id('tempdb..#temp') is null
BEGIN
CREATE TABLE #temp
(...)
END
...
Whenever you want to access the temp table from your caller, you should create the temporary table before calling the stored procedure.
By creating the temporary table conditionally in the Stored Procedure, it will work whether or not the caller creates the temporary table. The caller must of course create the temporary table with the correct structure, and DROP it when finished (or close the DB connection).
An option I've used in the past is to create the temp table prior to calling the stored proc that uses it. As long as you use the same open adodb connection it should work:
myAdoDBConn.Execute "CREATE TABLE #foo (ID integer)", , adCmdText
myADODBConn.Execute "StoredProcThatPopulatesFoo", , adCmdStoredProc
myAdoRecordset.Open "Select ID FROM #foo", myAdoDbConn, adOpenForwardOnly, adLockReadOnly
Do While Not myAdoRecordset.EOF
// do something with the record //
myAdoRecordset.EOF
Loop
In this example, the temp table stays available until you close the connection (myAdoDbConn).