sqldevrequiretektips
Programmer
If i create Temporary store procedure from VB on SQL server
and My application has more then 10 users..
so How does sql server handle this kind situation when multiple user are trying to create same name temporary procedure.
Is it really possible?
I have ask this question to VB developer but i didn't get any response...
so if anybody know about this, please help me out
Let me show you my code where i am creating store procedure.
Create the stored procedure we will work with
CreateStoredProcedure = False
On Error GoTo errorhandler
Const strLcPROCEDURE_NAME As String = "CreateStoredProcedure"
Dim cmdLvCommand As Command
Dim strSQL As Variant
Set cmdLvCommand = New Command
'First Check if the store procedure allreday exists
'cmdLvCommand.CommandType = adCmdText
cmdLvCommand.CommandText = "If Exists (select name from sysobjects "
cmdLvCommand.CommandText = cmdLvCommand.CommandText & _
"Where name = " & "'" & strMvStoredProcedureName & "'" & ")"
cmdLvCommand.CommandText = cmdLvCommand.CommandText & " Drop Procedure " & strMvStoredProcedureName
Set cmdLvCommand.ActiveConnection = cnMvConnection
cmdLvCommand.Execute
Set cmdLvCommand = Nothing
'Set cmdLvCommand.ActiveConnection = Nothing
Set cmdLvCommand = New Command
If strMvStoredProcedureName = "P_Retrive_Dowload_data_WIActCat_WIDay" Then
cmdLvCommand.CommandText = "CREATE PROCEDURE " & strMvStoredProcedureName
cmdLvCommand.CommandText = cmdLvCommand.CommandText & " AS "
cmdLvCommand.CommandText = cmdLvCommand.CommandText & " SET NOCOUNT ON "
cmdLvCommand.CommandText = cmdLvCommand.CommandText & "DECLARE @Error AS Integer "
strSQL = " Select A.CustLifeNo, A.WIActCatId, A.WIDayId, A.WeekNo " & _
"from WIActCat_WIDay A " & _
"Inner Join (select distinct (cust_life_num) from CUSTTB where " & where_sqldb & " ) B" & _
" On A.CustLifeNo = B.Cust_Life_num"
Debug.Print strSQL
cmdLvCommand.CommandText = cmdLvCommand.CommandText & strSQL
cmdLvCommand.Name = "CreateSP"
With cmdLvCommand
Set .ActiveConnection = cnMvConnection
.CommandType = adCmdText
.prepared = True
.Execute
End With
and My application has more then 10 users..
so How does sql server handle this kind situation when multiple user are trying to create same name temporary procedure.
Is it really possible?
I have ask this question to VB developer but i didn't get any response...
so if anybody know about this, please help me out
Let me show you my code where i am creating store procedure.
Create the stored procedure we will work with
CreateStoredProcedure = False
On Error GoTo errorhandler
Const strLcPROCEDURE_NAME As String = "CreateStoredProcedure"
Dim cmdLvCommand As Command
Dim strSQL As Variant
Set cmdLvCommand = New Command
'First Check if the store procedure allreday exists
'cmdLvCommand.CommandType = adCmdText
cmdLvCommand.CommandText = "If Exists (select name from sysobjects "
cmdLvCommand.CommandText = cmdLvCommand.CommandText & _
"Where name = " & "'" & strMvStoredProcedureName & "'" & ")"
cmdLvCommand.CommandText = cmdLvCommand.CommandText & " Drop Procedure " & strMvStoredProcedureName
Set cmdLvCommand.ActiveConnection = cnMvConnection
cmdLvCommand.Execute
Set cmdLvCommand = Nothing
'Set cmdLvCommand.ActiveConnection = Nothing
Set cmdLvCommand = New Command
If strMvStoredProcedureName = "P_Retrive_Dowload_data_WIActCat_WIDay" Then
cmdLvCommand.CommandText = "CREATE PROCEDURE " & strMvStoredProcedureName
cmdLvCommand.CommandText = cmdLvCommand.CommandText & " AS "
cmdLvCommand.CommandText = cmdLvCommand.CommandText & " SET NOCOUNT ON "
cmdLvCommand.CommandText = cmdLvCommand.CommandText & "DECLARE @Error AS Integer "
strSQL = " Select A.CustLifeNo, A.WIActCatId, A.WIDayId, A.WeekNo " & _
"from WIActCat_WIDay A " & _
"Inner Join (select distinct (cust_life_num) from CUSTTB where " & where_sqldb & " ) B" & _
" On A.CustLifeNo = B.Cust_Life_num"
Debug.Print strSQL
cmdLvCommand.CommandText = cmdLvCommand.CommandText & strSQL
cmdLvCommand.Name = "CreateSP"
With cmdLvCommand
Set .ActiveConnection = cnMvConnection
.CommandType = adCmdText
.prepared = True
.Execute
End With