Showing posts with label procedure. Show all posts
Showing posts with label procedure. Show all posts

Tuesday, March 27, 2012

Cannot Register Any Instance of SQL Server 2000 to AD

Hello; I keep getting this message, 'SQL Enterprise Manager could not add
server '(local)' to AD. Error: 14303: Stored procedure
'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
have the sufficient permissions to register any instance to AD, right? I even
installed SP4, but that didn't work. I"m a student of sql server services and
I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
DominickAre you a local administrator on the machine? The error is telling you
that EM can't access the system registry. You also need the rights on
AD to publish the instance, sorry - I don't recall off hand the exact
permission.
Dominick D. wrote:
> Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> server '(local)' to AD. Error: 14303: Stored procedure
> 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> have the sufficient permissions to register any instance to AD, right? I even
> installed SP4, but that didn't work. I"m a student of sql server services and
> I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> Dominick|||Yes, I am a local administrator on the machine where AD is located; I have
enterprise/domain admin rights. I don't understand why EM is not accessing
the registry. Can you dig a little deeper? Get some assistance?
Unfortunately, your response has not helped me.
"PSPDBA" wrote:
> Are you a local administrator on the machine? The error is telling you
> that EM can't access the system registry. You also need the rights on
> AD to publish the instance, sorry - I don't recall off hand the exact
> permission.
>
> Dominick D. wrote:
> > Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> > server '(local)' to AD. Error: 14303: Stored procedure
> > 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> > mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> > have the sufficient permissions to register any instance to AD, right? I even
> > installed SP4, but that didn't work. I"m a student of sql server services and
> > I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> >
> > Dominick
>|||Based on some reading, try change the SQL Service account to your
domain admin account, and use your domain admin to run the stored proc.
I would guess that the SQL Service account doesn't have the privileges
to read/edit the registy on the server.
Dominick D. wrote:
> Yes, I am a local administrator on the machine where AD is located; I have
> enterprise/domain admin rights. I don't understand why EM is not accessing
> the registry. Can you dig a little deeper? Get some assistance?
> Unfortunately, your response has not helped me.
> "PSPDBA" wrote:
> > Are you a local administrator on the machine? The error is telling you
> > that EM can't access the system registry. You also need the rights on
> > AD to publish the instance, sorry - I don't recall off hand the exact
> > permission.
> >
> >
> > Dominick D. wrote:
> > > Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> > > server '(local)' to AD. Error: 14303: Stored procedure
> > > 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> > > mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> > > have the sufficient permissions to register any instance to AD, right? I even
> > > installed SP4, but that didn't work. I"m a student of sql server services and
> > > I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> > >
> > > Dominick
> >
> >|||OK, I placed the SQLService domain user account into the domain admins group
and I was able to register another instance to the AD, so your advice worked;
however, I was not able to register the default instance to the AD :(. I
don't get that. Any other clue for that reason? Thanks for your help.
"PSPDBA" wrote:
> Based on some reading, try change the SQL Service account to your
> domain admin account, and use your domain admin to run the stored proc.
> I would guess that the SQL Service account doesn't have the privileges
> to read/edit the registy on the server.
>
> Dominick D. wrote:
> > Yes, I am a local administrator on the machine where AD is located; I have
> > enterprise/domain admin rights. I don't understand why EM is not accessing
> > the registry. Can you dig a little deeper? Get some assistance?
> > Unfortunately, your response has not helped me.
> >
> > "PSPDBA" wrote:
> >
> > > Are you a local administrator on the machine? The error is telling you
> > > that EM can't access the system registry. You also need the rights on
> > > AD to publish the instance, sorry - I don't recall off hand the exact
> > > permission.
> > >
> > >
> > > Dominick D. wrote:
> > > > Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> > > > server '(local)' to AD. Error: 14303: Stored procedure
> > > > 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> > > > mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> > > > have the sufficient permissions to register any instance to AD, right? I even
> > > > installed SP4, but that didn't work. I"m a student of sql server services and
> > > > I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> > > >
> > > > Dominick
> > >
> > >
>|||Ok, we're getting further. I did a little more reading - check the
MSSQLServerADHelper service and set it to use the domain admin account
too.
Dominick D. wrote:
> OK, I placed the SQLService domain user account into the domain admins group
> and I was able to register another instance to the AD, so your advice worked;
> however, I was not able to register the default instance to the AD :(. I
> don't get that. Any other clue for that reason? Thanks for your help.
> "PSPDBA" wrote:
> > Based on some reading, try change the SQL Service account to your
> > domain admin account, and use your domain admin to run the stored proc.
> >
> > I would guess that the SQL Service account doesn't have the privileges
> > to read/edit the registy on the server.
> >
> >
> > Dominick D. wrote:
> > > Yes, I am a local administrator on the machine where AD is located; I have
> > > enterprise/domain admin rights. I don't understand why EM is not accessing
> > > the registry. Can you dig a little deeper? Get some assistance?
> > > Unfortunately, your response has not helped me.
> > >
> > > "PSPDBA" wrote:
> > >
> > > > Are you a local administrator on the machine? The error is telling you
> > > > that EM can't access the system registry. You also need the rights on
> > > > AD to publish the instance, sorry - I don't recall off hand the exact
> > > > permission.
> > > >
> > > >
> > > > Dominick D. wrote:
> > > > > Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> > > > > server '(local)' to AD. Error: 14303: Stored procedure
> > > > > 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> > > > > mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> > > > > have the sufficient permissions to register any instance to AD, right? I even
> > > > > installed SP4, but that didn't work. I"m a student of sql server services and
> > > > > I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> > > > >
> > > > > Dominick
> > > >
> > > >
> >
> >|||OK, I can do that, but, I noticed that there is no such user/group called
MSSQLServerADHelper. Do I have to create it or is it already created?
"PSPDBA" wrote:
> Ok, we're getting further. I did a little more reading - check the
> MSSQLServerADHelper service and set it to use the domain admin account
> too.
>
> Dominick D. wrote:
> > OK, I placed the SQLService domain user account into the domain admins group
> > and I was able to register another instance to the AD, so your advice worked;
> > however, I was not able to register the default instance to the AD :(. I
> > don't get that. Any other clue for that reason? Thanks for your help.
> >
> > "PSPDBA" wrote:
> >
> > > Based on some reading, try change the SQL Service account to your
> > > domain admin account, and use your domain admin to run the stored proc.
> > >
> > > I would guess that the SQL Service account doesn't have the privileges
> > > to read/edit the registy on the server.
> > >
> > >
> > > Dominick D. wrote:
> > > > Yes, I am a local administrator on the machine where AD is located; I have
> > > > enterprise/domain admin rights. I don't understand why EM is not accessing
> > > > the registry. Can you dig a little deeper? Get some assistance?
> > > > Unfortunately, your response has not helped me.
> > > >
> > > > "PSPDBA" wrote:
> > > >
> > > > > Are you a local administrator on the machine? The error is telling you
> > > > > that EM can't access the system registry. You also need the rights on
> > > > > AD to publish the instance, sorry - I don't recall off hand the exact
> > > > > permission.
> > > > >
> > > > >
> > > > > Dominick D. wrote:
> > > > > > Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> > > > > > server '(local)' to AD. Error: 14303: Stored procedure
> > > > > > 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> > > > > > mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> > > > > > have the sufficient permissions to register any instance to AD, right? I even
> > > > > > installed SP4, but that didn't work. I"m a student of sql server services and
> > > > > > I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> > > > > >
> > > > > > Dominick
> > > > >
> > > > >
> > >
> > >
>|||Thats a service on the server, not a group/user.
Dominick D. wrote:
> OK, I can do that, but, I noticed that there is no such user/group called
> MSSQLServerADHelper. Do I have to create it or is it already created?
> "PSPDBA" wrote:
> > Ok, we're getting further. I did a little more reading - check the
> > MSSQLServerADHelper service and set it to use the domain admin account
> > too.
> >
> >
> > Dominick D. wrote:
> > > OK, I placed the SQLService domain user account into the domain admins group
> > > and I was able to register another instance to the AD, so your advice worked;
> > > however, I was not able to register the default instance to the AD :(. I
> > > don't get that. Any other clue for that reason? Thanks for your help.
> > >
> > > "PSPDBA" wrote:
> > >
> > > > Based on some reading, try change the SQL Service account to your
> > > > domain admin account, and use your domain admin to run the stored proc.
> > > >
> > > > I would guess that the SQL Service account doesn't have the privileges
> > > > to read/edit the registy on the server.
> > > >
> > > >
> > > > Dominick D. wrote:
> > > > > Yes, I am a local administrator on the machine where AD is located; I have
> > > > > enterprise/domain admin rights. I don't understand why EM is not accessing
> > > > > the registry. Can you dig a little deeper? Get some assistance?
> > > > > Unfortunately, your response has not helped me.
> > > > >
> > > > > "PSPDBA" wrote:
> > > > >
> > > > > > Are you a local administrator on the machine? The error is telling you
> > > > > > that EM can't access the system registry. You also need the rights on
> > > > > > AD to publish the instance, sorry - I don't recall off hand the exact
> > > > > > permission.
> > > > > >
> > > > > >
> > > > > > Dominick D. wrote:
> > > > > > > Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> > > > > > > server '(local)' to AD. Error: 14303: Stored procedure
> > > > > > > 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> > > > > > > mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> > > > > > > have the sufficient permissions to register any instance to AD, right? I even
> > > > > > > installed SP4, but that didn't work. I"m a student of sql server services and
> > > > > > > I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> > > > > > >
> > > > > > > Dominick
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >|||OK, how do I access it and by putting the sa into the domain admins group, I
was able to register both the default and named instance on the AD, so your
advice helped. Thanks.
"PSPDBA" wrote:
> Thats a service on the server, not a group/user.
>
> Dominick D. wrote:
> > OK, I can do that, but, I noticed that there is no such user/group called
> > MSSQLServerADHelper. Do I have to create it or is it already created?
> >
> > "PSPDBA" wrote:
> >
> > > Ok, we're getting further. I did a little more reading - check the
> > > MSSQLServerADHelper service and set it to use the domain admin account
> > > too.
> > >
> > >
> > > Dominick D. wrote:
> > > > OK, I placed the SQLService domain user account into the domain admins group
> > > > and I was able to register another instance to the AD, so your advice worked;
> > > > however, I was not able to register the default instance to the AD :(. I
> > > > don't get that. Any other clue for that reason? Thanks for your help.
> > > >
> > > > "PSPDBA" wrote:
> > > >
> > > > > Based on some reading, try change the SQL Service account to your
> > > > > domain admin account, and use your domain admin to run the stored proc.
> > > > >
> > > > > I would guess that the SQL Service account doesn't have the privileges
> > > > > to read/edit the registy on the server.
> > > > >
> > > > >
> > > > > Dominick D. wrote:
> > > > > > Yes, I am a local administrator on the machine where AD is located; I have
> > > > > > enterprise/domain admin rights. I don't understand why EM is not accessing
> > > > > > the registry. Can you dig a little deeper? Get some assistance?
> > > > > > Unfortunately, your response has not helped me.
> > > > > >
> > > > > > "PSPDBA" wrote:
> > > > > >
> > > > > > > Are you a local administrator on the machine? The error is telling you
> > > > > > > that EM can't access the system registry. You also need the rights on
> > > > > > > AD to publish the instance, sorry - I don't recall off hand the exact
> > > > > > > permission.
> > > > > > >
> > > > > > >
> > > > > > > Dominick D. wrote:
> > > > > > > > Hello; I keep getting this message, 'SQL Enterprise Manager could not add
> > > > > > > > server '(local)' to AD. Error: 14303: Stored procedure
> > > > > > > > 'sp_ActiveDirectory_SCP' failed to access registry key. Now, what does this
> > > > > > > > mean? I am the SA of this instance; I am the dbo, if you will, also. So, I
> > > > > > > > have the sufficient permissions to register any instance to AD, right? I even
> > > > > > > > installed SP4, but that didn't work. I"m a student of sql server services and
> > > > > > > > I'm in a training class, so I'd appreciate "guru"-level assistance. Thanks.
> > > > > > > >
> > > > > > > > Dominick
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > >
> > >
>

Monday, March 19, 2012

Cannot open database "database" requested by the login

We have a back end procedure that inserts/updates records in a table. Usually the upload file will have around 20k records. This procedure is called from our application which is designed using hibernate,struts.

Upload is getting completed. But after the upload is over and control goes to application code, we are again hitting the above table to get some details. Is this the root cause for the below issue?

This is what we get in application logs,

SQL Error: 4060, SQLState: S1000
2007-04-30 16:17:27,840 - ERROR [TP-Processor2] JDBCExceptionReporter.logExceptions(58) | Cannot open database "sdgebis" requested by the login. The login failed.
2007-04-30 16:17:27,840 - WARN [TP-Processor2] JDBCExceptionReporter.logExceptions(57) | SQL Error: 18456, SQLState: 28000
2007-04-30 16:17:27,840 - ERROR [TP-Processor2] JDBCExceptionReporter.logExceptions(58) | Login failed for user 'sa'.

2007-04-30 16:17:27,856 - WARN [TP-Processor2] SQLErrorCodeSQLExceptionTranslator.translate(279) | Unable to translate SQLException with errorCode '4060', will now try the fallback translator

What could be the reason for the above error?

Can anyone help me out please?Sounds like the two connections use different logins. And only one of them is mapped to a user in the database.

Cannot obtain recordset from stored procedure that contains Exec c

Hopefully someone can help. Using vbscript and ADO, I can call a very simpl
e
stored procedure that returns a recordset w/o any problems. However, when I
call a stored procedure that stuffs records into another table using a SQL
string built and the Exec command and then select the records from that
table--ADO always reports the recordset is closed.
The stored procedure works fine in Query Analyzer. It also doesn't matter
if table is temp or permanent. My workaround is to first call the stored
procedure followed by a second call to get the records. My goal is to use a
temp table in the stored procedure.
Psuedo code of stored procedure (which also uses cursor):
declare @.sqlstr varchar (100)
set @.sqlstr = 'insert into tmptable select field from anothertable'
exec(@.sqpstr)
select * from tmptableAre you setting SET NOCOUNT ON at the begining of the sp?
AMB
"reedholm" wrote:

> Hopefully someone can help. Using vbscript and ADO, I can call a very sim
ple
> stored procedure that returns a recordset w/o any problems. However, when
I
> call a stored procedure that stuffs records into another table using a SQL
> string built and the Exec command and then select the records from that
> table--ADO always reports the recordset is closed.
> The stored procedure works fine in Query Analyzer. It also doesn't matter
> if table is temp or permanent. My workaround is to first call the stored
> procedure followed by a second call to get the records. My goal is to use
a
> temp table in the stored procedure.
> Psuedo code of stored procedure (which also uses cursor):
> declare @.sqlstr varchar (100)
> set @.sqlstr = 'insert into tmptable select field from anothertable'
> exec(@.sqpstr)
> select * from tmptable
>

Sunday, March 11, 2012

Cannot load the DLL replincrementlsn extended procedure?

Hi All,

trying to setup a new push subscription and got the following error!

'Error 14053: Cannot load the DLL replincrementlsn extended procedure, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
The subscription could not be updated at this time.
The subscription could not be created.'

Anyone have any ideas - I think it has some .dll missing or a sp missing but I couldn't find any such file on the CD.

Any help much appreciated...

Regards

DavejWhat is the level of service pack on both the machines?|||Hi Satya,

SP3...|||Try installing SP3a.

Thursday, March 8, 2012

Cannot link from strored procedure...Error detected by DLL

Hi,

I'm using Crystal Reports Version 8.5 and SQLServer2000.
The main report is using Stored Procedure as datasource where as 2 sub reports using tables as datasource. I'm linking these subreports with some values from the main report.

When I run the main report it pops up the two error messages saying that

"Cannot link from strored procedure" followed by "Error detected by DLL".

Pls advice. Thanks in advance for your immediate attention.Is that Stored Procedure exits?
If not redesign the report|||Hi Madhi,

Yes, the stored procedure exists and works fine if i remove the sub reports. So I re-designed one of the sub-reports and its working now with out any problems.

Thanks for your reply.

Dubasi

Friday, February 24, 2012

cannot insert(urgent)

Hi
I am using Mssql2000 and i am facing a problem while saving data from my
application.
This Procedure is working fine.
CREATE PROCEDURE test(@.edate datetime,@.supp_idv char
(8),@.div char(2),@.dept
char(3))
AS CREATE table #oi(supp_id char(8),inv_no char
(15),inv_date datetime
NULL,dept_code char(3),dr numeric(14,3),cr numeric
(14,3),bal
numeric(14,3),tr_type char(2),entry_type char(1))
begin
Insert into #oi
select supp_id,inv_no,inv_date,dept_code,dr,cr,
(select sum(cr) - sum(dr) from ap_spled b WHERE
a.supp_id =
b.supp_id and
a.inv_no = b.inv_no group by
b.inv_no),trans_type,entry_type
from ap_spled a where division = @.div AND inv_date <=
@.edate and supp_id =
@.supp_idv and
(select sum(cr) - sum(dr) from ap_spled b WHERE
a.supp_id =
b.supp_id and a.inv_no = b.inv_no
group by b.inv_no) < 0 ;
select
a.supp_id,a.inv_no,a.inv_date,a.dr,a.cr,a.bal,a.tr
_type,a.entry_type,a.dept,d.name from #oi
a,supplier_file d
where a.supp_id = d.supplier_id order by supp_id,inv_no
The problem is that after retrieving this report in my application,if any
other user try to save from any other module ie
inserting any record into ap_spled table, the application is
hanging and cannot insert into this table.No users can save their data this
time, it is creating big prblm.This is the insert from my appl.This syntax is
also working fine if the procedure is not execute.
INSERT INTO ap_spled
(tr_no,entry_date,supp_id,dr_amt,cr_amt,trans_type ,acc_desc,division,dept_code,entry_type,inv_no,inv _date )
VALUES
(:tr,:dt,:sup,:dmt,:amt,'uu',:descr,:division,:dep t_code,:entry_type,:no,:vd
) ;
Is their any problem in my storedproced syntax or this is due to any table
locking pblm.How can i solve this.This is creating too much prbm
Please help.
Thanks
Thanks
On Fri, 11 Mar 2005 23:13:02 -0800, shif wrote:
(snip)
>The problem is that after retrieving this report in my application,if any
>other user try to save from any other module ie
>inserting any record into ap_spled table, the application is
>hanging and cannot insert into this table.
(snip)
Hi shif,
Some follow-up questions, the answers to which might help pinpoint the
poblem:
1. When this happens, how do you solve the issue? Wait until it goes
away (and if so, how long does that take, on average)? Close and restart
the application that tries to insert? Close and restart the application
that generated the report? Shutdown and restart the server? Or yet
something else?
2. Next time this happens, BEFORE taking any corrective action, open a
Query Analyzer window; type EXEC sp_who2; EXEC sp_lock and execute (make
sure that the "Results in Text" option is chosen), then copy the output
and paste it in a reply to this message.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||This is the query analyser result after giving sp_who2 at the time of same
prblm.
And If I Close the application that generated the report,
the hanging will release and can save the data.
SPID Status Login HostName BlkBy DBName Command
CPUTime DiskIO LastBatch ProgramName SPID
-- -- -- -- -- --
-- -- -- -- -- --
1 sleeping sa . . NULL LOG WRITER
0 0 03/12 11:57:30 1
2 BACKGROUND sa . . master SIGNAL
HANDLER 0 0 03/12 11:57:30 2
3 BACKGROUND sa . . NULL LOCK
MONITOR 0 0 03/12 11:57:30 3
4 BACKGROUND sa . . NULL LAZY
WRITER 0 0 03/12 11:57:30 4
5 BACKGROUND sa . . master TASK
MANAGER 0 17 03/12 11:57:30 5
6 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 6
7 sleeping sa . . NULL CHECKPOINT
SLEEP 0 51 03/12 11:57:30 7
8 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 8
9 BACKGROUND sa . . master TASK
MANAGER 0 9 03/12 11:57:30 9
10 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 10
11 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 11
12 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 12
13 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 13
14 BACKGROUND sa . . master TASK
MANAGER 0 647 03/12 11:57:30 14
51 sleeping sa . . sns_acc AWAITING
COMMAND 5672 24 03/13 09:55:02 51
52 sleeping sa . . sns_acc AWAITING
COMMAND 2859 0 03/13 09:59:10 52
53 sleeping sa . . sns_acc AWAITING
COMMAND 2734 0 03/13 09:58:20 53
54 sleeping sa . . sns_acc AWAITING
COMMAND 11750 20 03/13 09:36:53 54
55 sleeping sa . . sns_acc AWAITING
COMMAND 4594 0 03/13 09:42:13 55
56 sleeping sa . . sns_acc AWAITING
COMMAND 2547 1 03/13 09:54:14 56
57 sleeping sa . . sns_acc AWAITING
COMMAND 4594 194 03/13 09:50:06 57
58 sleeping sa . . sns_acc AWAITING
COMMAND 5500 0 03/13 09:58:07 58
59 sleeping sa . . sns_acc AWAITING
COMMAND 5266 0 03/13 09:14:18 59
60 sleeping sa . . sns_acc AWAITING
COMMAND 8875 0 03/13 09:13:22 60
61 sleeping sa . . sns_acc AWAITING
COMMAND 9000 0 03/13 09:15:11 61
62 sleeping sa . . sns_acc AWAITING
COMMAND 4594 0 03/13 09:42:33 62
63 sleeping sa NAZAR . sns_acc AWAITING
COMMAND 5344 0 03/13 09:55:02 MS SQLEM 63
64 sleeping sa . 66 sns_acc SELECT
3031 0 03/13 10:00:11 64
65 RUNNABLE sa NAZAR . sns_acc SELECT
INTO 4594 11 03/13 09:49:33 SQL Query Analyzer 65
66 sleeping sa . 58 sns_acc INSERT
5719 0 03/13 09:59:55 66
67 sleeping sa . . sns_acc AWAITING
COMMAND 5297 0 03/13 09:52:47 67
"Hugo Kornelis" wrote:

> On Fri, 11 Mar 2005 23:13:02 -0800, shif wrote:
> (snip)
> (snip)
> Hi shif,
> Some follow-up questions, the answers to which might help pinpoint the
> poblem:
> 1. When this happens, how do you solve the issue? Wait until it goes
> away (and if so, how long does that take, on average)? Close and restart
> the application that tries to insert? Close and restart the application
> that generated the report? Shutdown and restart the server? Or yet
> something else?
> 2. Next time this happens, BEFORE taking any corrective action, open a
> Query Analyzer window; type EXEC sp_who2; EXEC sp_lock and execute (make
> sure that the "Results in Text" option is chosen), then copy the output
> and paste it in a reply to this message.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||On Sat, 12 Mar 2005 22:23:01 -0800, shif wrote:

>This is the query analyser result after giving sp_who2 at the time of same
>prblm.
>And If I Close the application that generated the report,
>the hanging will release and can save the data.
(snip)
Hi shif,
Thanks for posting this. Have a look at these three rows:

>SPID Status Login HostName BlkBy DBName Command
> CPUTime DiskIO LastBatch ProgramName SPID
>-- -- -- -- -- --
>-- -- -- -- -- --
(snip)
>58 sleeping sa . . sns_acc AWAITING
>COMMAND 5500 0 03/13 09:58:07 58
(...)
>64 sleeping sa . 66 sns_acc SELECT
> 3031 0 03/13 10:00:11 64
(...)
>66 sleeping sa . 58 sns_acc INSERT
> 5719 0 03/13 09:59:55 66
As you can see (even easier if you edit them to merge the split lines
again), the connection with SPID 64 is blocked by (column BlkBy) SPID
66, which is in turn blocked by connection 58.
Unfortunately, you didn't post the output from sp_lock. But I guess that
this would show that either SPID 66 or (more likely) SPID 58 is used for
generating the report, but still holds some locks that are also required
for the insert.
My guess, at this point, would be that the code that generated the
report opens a transaction, but fails to close it. In the transaction,
either some data gets updated, or a non-standard isolation level is used
to maintain locks on data being read. While the acquiring of the locks
might be legitimate in the context of the report generation, they should
really be released when the report is finished. My suspicion is that
this doesn't happen, because the report generating code fails to execute
an COMMIT TRANSACTION command.
When you close the application, the connection gets broken and SQL
Server will rollback the transaction and then release the locks. Then,
your other connection will get the locks they required and were wating
for; they'll continue to run - until you re-run the report.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Hi sir
I forget the sp_lock i am adding here and it is lengthy upto 450 rows i
deleted some rows.if i have your mail id i can mail you the full text file.
One more thing i forgot to tell is ,actualy the database which i am using
was working in mssql7.I was just attached to ms2000 srvr,now i exported all
data into a new database in same server,But again i saw today again from same
screen not save but hanging one time in new db.here is the sp_who2 and sp_lock
..
sp_lock
spid dbid ObjId IndId Type Resource Mode Status
-- -- -- -- -- -- -- --
51 2 3 2 KEY (9c01d388586f) X GRANT
51 2 2 1 KEY (590093cc6231) X GRANT
52 8 0 0 DB S GRANT
53 8 0 0 DB S GRANT
54 8 0 0 DB S GRANT
55 8 0 0 DB S GRANT
56 8 0 0 DB S GRANT
56 2 6 0 TAB IX GRANT
56 2 2 0 TAB IX GRANT
56 2 1 0 TAB IX GRANT
56 2 3 1 KEY (7d00de4e4040) X GRANT
56 2 3 1 KEY (8000885e2318) X GRANT
56 8 1410104064 0 TAB S GRANT
56 2 3 1 KEY (810066f1960a) X GRANT
56 2 3 2 KEY (120262fbbe82) X GRANT
56 2 3 2 KEY (b901f41a78b7) X GRANT
56 2 3 2 KEY (a30233242999) X GRANT
56 2 3 2 KEY (a701bbd2b59b) X GRANT
56 2 3 1 KEY (820003962ab2) X GRANT
56 2 0 0 IDX IDX: 2:100335883 X GRANT
56 2 1003358839 0 TAB Sch-M GRANT
56 2 3 1 KEY (7e00bb29fcf8) X GRANT
56 2 3 2 KEY (c401f8c9de07) X GRANT
56 2 3 2 KEY (ad024e966d4d) X GRANT
57 2 1 2 KEY (b516cfe74d67) X GRANT
57 2 3 1 KEY (ef00eaadae35) X GRANT
57 2 3 2 KEY (9c020770e7da) X GRANT
57 2 2 1 KEY (e80092c5f44b) X GRANT
57 2 0 0 IDX IDX: 2:891358440 X GRANT
57 2 891358440 0 TAB Sch-M GRANT
57 2 3 2 KEY (a602bbabc534) X GRANT
57 2 3 1 KEY (ed006165a79f) X GRANT
57 2 3 1 KEY (f100d9da71d5) X GRANT
57 2 3 2 KEY (9f0226e43aa2) X GRANT
57 2 3 2 KEY (0e02b8060e3b) X GRANT
57 2 1 3 KEY (e800e561205a) X GRANT
57 2 3 1 KEY (f000bcbdcd6d) X GRANT
57 2 3 1 KEY (ec0004021b27) X GRANT
57 2 3 1 KEY (ee008fca128d) X GRANT
57 2 3 1 KEY (f2003775c4c7) X GRANT
57 2 3 2 KEY (9602c76d7c54) X GRANT
57 2 99 0 RID 1:78:1 X GRANT
57 2 3 1 KEY (ea00d85d7002) X GRANT
57 2 3 2 KEY (12035d1d7fdb) X GRANT
57 2 3 2 KEY (2b02dc4b8826) X GRANT
57 2 3 2 KEY (1e033df41ec8) X GRANT
57 2 3 1 KEY (eb00bd3accba) X GRANT
57 2 1 1 KEY (e8009061461e) X GRANT
57 2 3 2 KEY (35023d7f78d0) X GRANT
57 2 0 0 PAG 1:88 X GRANT
57 2 9 0 TAB IX GRANT
57 2 12 0 TAB IX GRANT
57 2 11 0 TAB IX GRANT
57 2 99 0 RID 1:78:0 X GRANT
57 2 0 0 PAG 1:78 X GRANT
57 2 0 0 PAG 1:77 X GRANT
57 2 0 0 EXT 1:88 X GRANT
58 2 3 1 KEY (89008d396180) X GRANT
58 2 3 2 KEY (5e01e45197c4) X GRANT
58 2 3 1 KEY (85003586b7ca) X GRANT
58 2 3 2 KEY (e601a49ec50f) X GRANT
58 2 3 1 KEY (35005b77329d) X GRANT
58 2 99 0 RID 1:121:0 X GRANT
58 2 99 0 RID 1:123:0 X GRANT
58 2 3 1 KEY (3100e3c8e4d7) X GRANT
58 2 0 0 PAG 1:121 X GRANT
58 2 3 1 KEY (4d00badd2f69) X GRANT
58 2 2 1 KEY (49007dcee1a2) X GRANT
58 2 99 0 RID 1:252:0 X GRANT
58 2 0 0 PAG 1:252 X GRANT
58 2 3 1 KEY (4c0003e5f8f4) X GRANT
58 2 3 1 KEY (4f00311526c3) X GRANT
58 2 3 1 KEY (4e00dfba93d1) X GRANT
58 2 3 1 KEY (530089aaf089) X GRANT
58 2 3 1 KEY (52006705459b) X GRANT
58 2 3 1 KEY (3a0048a3eb2f) X GRANT
58 2 3 2 KEY (000231e2855c) X GRANT
58 2 3 2 KEY (6f01f7b5e64f) X GRANT
58 2 3 2 KEY (57026d5bbde3) X GRANT
58 2 3 2 KEY (7a01dcdc9a6a) X GRANT
58 2 3 2 KEY (5b0251f72f39) X GRANT
58 2 3 1 KEY (3600f01c3d65) X GRANT
58 2 3 2 KEY (3602a72cacc0) X GRANT
58 2 622833481 0 TAB Sch-M GRANT
58 2 494833025 0 TAB Sch-M GRANT
58 2 1 3 KEY (4900a5f7bb28) X GRANT
58 2 3 1 KEY (51000262f923) X GRANT
58 2 3 2 KEY (590270009824) X GRANT
58 2 3 2 KEY (b001ef43c30a) X GRANT
58 2 3 1 KEY (3700d0bf3b37) X GRANT
58 2 3 1 KEY (320086af586f) X GRANT
58 2 3 1 KEY (36003e108e25) X GRANT
58 2 3 1 KEY (8a00e85edd38) X GRANT
58 2 3 1 KEY (8700be4ebe60) X GRANT
58 2 3 1 KEY (84008cbe6057) X GRANT
58 2 3 1 KEY (8b0006f1682a) X GRANT
58 2 3 1 KEY (30005af0334a) X GRANT
58 2 3 1 KEY (33006800ed7d) X GRANT
58 2 1 1 KEY (4900d0f7dd6c) X GRANT
58 2 3 2 KEY (7502b83841ec) X GRANT
58 2 3 2 KEY (ce016cf265f3) X GRANT
58 2 3 2 KEY (8e01a236c901) X GRANT
58 2 3 1 KEY (3200a78b5fea) X GRANT
58 2 3 2 KEY (720182f319f5) X GRANT
58 2 3 2 KEY (740139cfb2a2) X GRANT
58 2 3 1 KEY (3700a60c5e3d) X GRANT
58 2 3 1 KEY (30002c435640) X GRANT
58 2 3 1 KEY (3100c2ece352) X GRANT
58 2 3 2 KEY (8802393b156f) X GRANT
58 2 3 1 KEY (33001eb38877) X GRANT
58 2 2 1 KEY (2d000211c41d) X GRANT
58 2 3 2 KEY (ad02bb7a3e55) X GRANT
58 2 1 3 KEY (2d00f2931699) X GRANT
58 2 2 1 KEY (2f00d83b7a82) X GRANT
58 2 3 2 KEY (71010a60f6ca) X GRANT
58 2 3 2 KEY (65022c456bed) X GRANT
58 2 3 2 KEY (1c0296c64325) X GRANT
58 2 1 2 KEY (a416b6eaa566) X GRANT
58 2 3 2 KEY (5f0124fb5aa1) X GRANT
58 2 3 2 KEY (b702c6c87a81) X GRANT
58 2 3 2 KEY (7302a563642b) X GRANT
58 2 3 2 KEY (5c015f6d3c93) X GRANT
58 2 1 3 KEY (2f00b3d3188c) X GRANT
58 2 3 2 KEY (5002af3c2995) X GRANT
58 2 3 2 KEY (78017fa8ec67) X GRANT
58 2 3 2 KEY (38025c196d65) X GRANT
58 2 3 1 KEY (5400eccd4c31) X GRANT
58 2 3 1 KEY (4b006682444c) X GRANT
58 2 3 2 KEY (59024cac0afe) X GRANT
58 2 686833709 0 TAB Sch-M GRANT
58 2 0 0 IDX IDX: 2:686833709 X GRANT
58 2 3 1 KEY (2e00d1383ae0) X GRANT
58 2 3 2 KEY (b1012fe90e6f) X GRANT
58 2 3 2 KEY (3402a73ce927) X GRANT
58 2 1 1 KEY (8100cf4109b0) X GRANT
58 2 3 1 KEY (4a00882df15e) X GRANT
58 2 3 1 KEY (500054729a7b) X GRANT
58 2 1 3 KEY (8100ba416ff4) X GRANT
58 2 3 2 KEY (c60132dde66c) X GRANT
58 2 2 1 KEY (81008e0ab94d) X GRANT
58 2 3 2 KEY (63020db2dcf0) X GRANT
58 2 3 1 KEY (39002dc45797) X GRANT
58 2 3 1 KEY (3800c36be285) X GRANT
58 2 3 2 KEY (e401beea3b50) X GRANT
58 2 1 1 KEY (2f00c6d37ec8) X GRANT
58 2 3 1 KEY (8300e9d9dcef) X GRANT
58 2 3 1 KEY (8800db2902d8) X GRANT
58 2 3 1 KEY (8c006396d492) X GRANT
58 2 3 2 KEY (9601fc194a9e) X GRANT
58 2 3 2 KEY (c30122edca89) X GRANT
58 2 3 2 KEY (8b0171b6b1e4) X GRANT
58 2 3 1 KEY (34000d6751c5) X GRANT
58 2 3 1 KEY (2f003f978ff2) X GRANT
58 2 3 1 KEY (3800b5d8878f) X GRANT
58 2 3 2 KEY (7f02c58a0538) X GRANT
58 2 3 1 KEY (8200077669fd) X GRANT
58 2 3 2 KEY (ab02a6211b92) X GRANT
59 2 3 2 KEY (530262013702) X GRANT
59 2 3 2 KEY (ee01a3dbd3c6) X GRANT
59 2 3 1 KEY (c20049df58db) X GRANT
59 2 99 0 RID 1:83:4 X GRANT
59 2 3 1 KEY (c600f1608e91) X GRANT
59 2 3 1 KEY (c000958033fe) X GRANT
59 2 3 2 KEY (e202d8f3d456) X GRANT
59 2 1166835419 0 TAB Sch-M GRANT
59 2 0 0 IDX IDX: 2:116683541 X GRANT
59 2 3 2 KEY (480202cea6d6) X GRANT
59 2 3 2 KEY (2d02ce0794e9) X GRANT
59 2 3 2 KEY (e7014fa399f4) X GRANT
59 2 3 2 KEY (2002e139c422) X GRANT
59 2 3 2 KEY (f4023e1e8569) X GRANT
59 2 3 1 KEY (df006775fe0b) X GRANT
59 2 3 1 KEY (2400ca2649fa) X GRANT
59 2 3 2 KEY (ed0163711ea3) X GRANT
59 2 0 0 IDX IDX: 2:108683513 X GRANT
59 2 1086835134 0 TAB Sch-M GRANT
59 2 2 1 KEY (db00b6aaf8a1) X GRANT
59 2 1 1 KEY (7600d23c06ae) X GRANT
59 2 3 1 KEY (280072999fb0) X GRANT
59 2 3 1 KEY (dc005585203c) X GRANT
59 2 3 1 KEY (e300dfca2841) X GRANT
59 2 3 2 KEY (75023f81917e) X GRANT
59 2 3 1 KEY (dd00bb2a952e) X GRANT
59 2 99 0 RID 1:83:3 X GRANT
59 2 99 0 RID 1:265:3 X GRANT
59 2 3 2 KEY (76022a829f89) X GRANT
59 2 3 2 KEY (c502d70311df) X GRANT
59 2 1054835020 0 TAB Sch-M GRANT
59 2 0 0 IDX IDX: 2:105483502 X GRANT
59 2 0 0 IDX IDX: 2:587357357 X GRANT
59 2 99 0 RID 1:265:4 X GRANT
59 2 3 2 KEY (05034890c140) X GRANT
59 2 3 2 KEY (ea0243acc1bd) X GRANT
59 2 3 2 KEY (b801aadcc2bb) X GRANT
59 2 3 1 KEY (4f0081114225) X GRANT
59 2 3 2 KEY (9901c89022fd) X GRANT
59 2 3 2 KEY (6b0113c06a55) X GRANT
59 2 1 3 KEY (7600a73c60ea) X GRANT
59 2 3 2 KEY (dc0182a7d165) X GRANT
59 2 3 1 KEY (81008ec31911) X GRANT
59 2 587357357 0 TAB Sch-M GRANT
59 2 3 2 KEY (d5017a82f3c9) X GRANT
59 2 3 1 KEY (7d00367ccf5b) X GRANT
59 2 3 1 KEY (7700ea23a47e) X GRANT
59 2 3 2 KEY (48022e9d1de7) X GRANT
59 2 3 2 KEY (8202c9f8391e) X GRANT
59 2 3 1 KEY (af005c6d402e) X GRANT
59 2 3 1 KEY (b4006e9d9e19) X GRANT
59 2 3 1 KEY (ae00b2c2f53c) X GRANT
59 2 3 1 KEY (b800d6224853) X GRANT
59 2 1 3 KEY (db000c3967a4) X GRANT
59 2 3 1 KEY (4d000ad94b8f) X GRANT
59 2 1 1 KEY (ad001f254d94) X GRANT
59 2 99 0 RID 1:83:5 X GRANT
59 2 3 2 KEY (11032879a053) X GRANT
59 2 1 3 KEY (be00e9b4690b) X GRANT
59 2 3 2 KEY (7d023b626dd6) X GRANT
59 2 3 2 KEY (4a021f958311) X GRANT
59 2 99 0 RID 1:265:5 X GRANT
59 2 3 2 KEY (0b02e0c0b85a) X GRANT
59 2 3 2 KEY (0002fcd2ea7e) X GRANT
59 2 3 2 KEY (1d0212a37d37) X GRANT
59 2 3 2 KEY (e302a4bc0768) X GRANT
59 2 3 2 KEY (6402e44233a7) X GRANT
59 2 99 0 RID 1:83:6 X GRANT
59 2 1 2 KEY (a516e15fb233) X GRANT
59 2 3 2 KEY (a0020c139ab2) X GRANT
59 2 3 2 KEY (7c018b8b4961) X GRANT
59 2 3 2 KEY (d902d90e43bc) X GRANT
59 2 3 1 KEY (27009c362aa2) X GRANT
59 2 3 2 KEY (7602a911580d) X GRANT
59 2 3 2 KEY (4e0150db01c9) X GRANT
59 2 3 1 KEY (2100f8d697cd) X GRANT
59 2 3 1 KEY (23002489fce8) X GRANT
59 2 2 1 KEY (4c003c6ce3ea) X GRANT
59 2 3 2 KEY (f2015f39f403) X GRANT
59 2 99 0 RID 1:265:6 X GRANT
59 2 1 3 KEY (4c00df72296c) X GRANT
59 2 3 2 KEY (7b014b218404) X GRANT
59 2 3 2 KEY (b901b05ddd89) X GRANT
59 2 3 2 KEY (c3011dd2e151) X GRANT
59 2 3 1 KEY (20009db12b75) X GRANT
59 2 3 2 KEY (8e01e64c5a6a) X GRANT
59 2 3 1 KEY (2600f951961a) X GRANT
59 2 3 1 KEY (e100ecbdf7a1) X GRANT
59 2 3 1 KEY (e500540221eb) X GRANT
59 2 3 1 KEY (e400baad94f9) X GRANT
59 2 3 1 KEY (220041ee4050) X GRANT
59 2 3 1 KEY (e000021242b3) X GRANT
59 2 99 0 RID 1:83:7 X GRANT
59 2 1 3 KEY (1e00e99c369e) X GRANT
59 2 3 1 KEY (4e00e476fe9d) X GRANT
59 2 3 2 KEY (7802b44a7dca) X GRANT
59 2 3 2 KEY (ac026cfafba1) X GRANT
59 2 3 2 KEY (d702c455667b) X GRANT
59 2 475356958 0 TAB Sch-M GRANT
59 2 0 0 IDX IDX: 2:475356958 X GRANT
59 2 3 1 KEY (c3002cb8e463) X GRANT
59 2 3 2 KEY (ef010149377d) X GRANT
59 2 3 1 KEY (c100f0e78f46) X GRANT
59 2 3 1 KEY (c70094073229) X GRANT
59 2 3 1 KEY (e20089da4b19) X GRANT
59 2 99 0 RID 1:265:7 X GRANT
59 2 3 2 KEY (a6015ec98acd) X GRANT
59 2 3 1 KEY (e60031659d53) X GRANT
59 2 3 2 KEY (0b02fc0d2c21) X GRANT
59 2 3 1 KEY (7c00531b73e3) X GRANT
59 2 3 1 KEY (8000eba4a5a9) X GRANT
59 2 3 1 KEY (c400c2175171) X GRANT
59 2 1 1 KEY (4c00aa724f28) X GRANT
59 2 3 2 KEY (5902f55ebf3e) X GRANT
59 2 99 0 RID 1:255:1 X GRANT
59 2 3 1 KEY (c8007aa8873b) X GRANT
59 2 3 2 KEY (dd01420d1c00) X GRANT
59 2 99 0 RID 1:265:1 X GRANT
59 2 3 1 KEY (b3000bfa22a1) X GRANT
59 2 3 1 KEY (b000390afc96) X GRANT
59 2 3 1 KEY (b6005dea41f9) X GRANT
59 2 3 2 KEY (9202e05db1c9) X GRANT
59 2 3 1 KEY (b700b345f4eb) X GRANT
59 2 3 2 KEY (a2021148bf75) X GRANT
59 2 0 0 EXT 1:272 X GRANT
59 2 3 1 KEY (b500388dfd41) X GRANT
59 2 3 2 KEY (2802bf1647bd) X GRANT
59 2 3 1 KEY (b10080322b0b) X GRANT
59 2 3 1 KEY (2500af41f542) X GRANT
59 2 3 1 KEY (1f00731e9e67) X GRANT
59 2 3 1 KEY (290017fe2308) X GRANT
59 2 3 2 KEY (25024f5e16cb) X GRANT
59 2 3 1 KEY (57006e39f6e0) X GRANT
59 2 3 1 KEY (5300d68620aa) X GRANT
59 2 3 2 KEY (0302beef3bc5) X GRANT
59 2 3 2 KEY (110204d8baa9) X GRANT
59 2 859358326 0 TAB Sch-M GRANT
59 2 0 0 IDX IDX: 2:859358326 X GRANT
59 2 99 0 RID 1:83:1 X GRANT
59 2 2 1 KEY (1e0029c04d24) X GRANT
59 2 2 1 KEY (ad00944e5e86) X GRANT
59 2 3 2 KEY (070355cbe487) X GRANT
59 2 3 1 KEY (de00de4d2996) X GRANT
59 2 3 2 KEY (b402ab55b0bf) X GRANT
59 2 3 1 KEY (5000382995b8) X GRANT
59 2 3 1 KEY (5400809643f2) X GRANT
59 2 3 2 KEY (e8025ef7e47a) X GRANT
59 2 3 2 KEY (54026227c7c5) X GRANT
59 2 2 1 KEY (be008cfdf811) X GRANT
59 2 3 1 KEY (7a00d8d37a49) X GRANT
59 2 3 1 KEY (7800048c116c) X GRANT
59 2 3 2 KEY (6001da66a88a) X GRANT
59 2 3 1 KEY (7e00606cac03) X GRANT
59 2 3 2 KEY (fa010116779c) X GRANT
59 2 99 0 RID 1:265:2 X GRANT
59 2 3 1 KEY (56000b5e4a58) X GRANT
59 2 1 1 KEY (be009cb40f4f) X GRANT
59 2 3 1 KEY (bf007b2f86ec) X GRANT
59 2 3 2 KEY (0a023ca7e144) X GRANT
59 2 3 2 KEY (4d019071ccac) X GRANT
59 2 3 1 KEY (5200b3e19c12) X GRANT
59 2 3 1 KEY (c500a770edc9) X GRANT
59 2 99 0 RID 1:83:2 X GRANT
59 2 3 1 KEY (c9001fcf3b83) X GRANT
59 2 3 1 KEY (b200e55597b3) X GRANT
59 2 1 3 KEY (ad006a252bd0) X GRANT
59 2 3 2 KEY (bb0143fd62ce) X GRANT
59 2 1 1 KEY (db00793901e0) X GRANT
59 2 3 1 KEY (7f00050b10bb) X GRANT
59 2 3 2 KEY (0302857cb7b4) X GRANT
59 2 3 1 KEY (7b00bdb4c6f1) X GRANT
59 2 3 1 KEY (790061ebadd4) X GRANT
59 2 0 0 PAG 1:255 X GRANT
59 2 0 0 PAG 1:254 X GRANT
59 2 99 0 RID 1:255:0 X GRANT
59 2 2 1 KEY (76001c75619c) X GRANT
59 2 99 0 RID 1:249:0 X GRANT
59 2 3 2 KEY (910196bfa162) X GRANT
59 2 0 0 PAG 1:193 X GRANT
59 2 0 0 PAG 1:199 X GRANT
59 2 0 0 PAG 1:266 X GRANT
59 2 0 0 PAG 1:267 X GRANT
59 2 0 0 PAG 1:272 X GRANT
59 2 0 0 PAG 1:270 X GRANT
59 2 0 0 PAG 1:271 X GRANT
59 2 3 2 KEY (63014defe9ca) X GRANT
59 2 1 1 KEY (1e009c9c50da) X GRANT
59 2 3 2 KEY (a5019e6347a8) X GRANT
59 2 0 0 PAG 1:86 X GRANT
59 2 1 0 TAB IX GRANT
59 2 3 0 TAB IX GRANT
59 2 2 0 TAB IX GRANT
59 2 6 0 TAB IX GRANT
59 8 0 0 DB S GRANT
60 8 0 0 DB S GRANT
61 8 0 0 DB S GRANT
61 8 1410104064 0 TAB IX WAIT
62 1 85575343 0 TAB IS GRANT
sp_who
SPID Status Login HostName BlkBy DBName Command
CPUTime DiskIO LastBatch ProgramName SPID
-- -- -- -- -- --
-- -- -- -- -- --
1 sleeping sa . . NULL LOG
WRITER 31 0 03/12 11:57:30 1
2 BACKGROUND sa . . master SIGNAL
HANDLER 0 0 03/12 11:57:30 2
3 BACKGROUND sa . . NULL LOCK
MONITOR 0 0 03/12 11:57:30 3
4 BACKGROUND sa . . NULL LAZY
WRITER 0 0 03/12 11:57:30 4
5 BACKGROUND sa . . master TASK
MANAGER 0 55 03/12 11:57:30 5
6 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 6
7 sleeping sa . . NULL
CHECKPOINT SLEEP 219 246 03/12 11:57:30 7
8 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 8
9 BACKGROUND sa . . master TASK
MANAGER 0 619 03/12 11:57:30 9
10 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 10
11 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 11
12 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 12
13 BACKGROUND sa . . master TASK
MANAGER 0 0 03/12 11:57:30 13
14 BACKGROUND sa . . master TASK
MANAGER 0 652 03/12 11:57:30 14
51 sleeping sa . . sns_acc2 AWAITING
COMMAND 11094 23 03/14 10:17:27 51
52 sleeping sa . . sns_acc2 AWAITING
COMMAND 4734 29 03/14 10:36:50 52
53 sleeping sa . . sns_acc2 AWAITING
COMMAND 13875 340 03/14 10:36:14 53
54 sleeping sa . . sns_acc2 AWAITING
COMMAND 23344 0 03/14 09:47:44 54
55 sleeping sa . . sns_acc2 AWAITING
COMMAND 1125 0 03/14 10:36:37 55
56 sleeping sa . . sns_acc2 AWAITING
COMMAND 14906 25 03/14 10:28:29 56
57 sleeping sa . . sns_acc2 AWAITING
COMMAND 15781 25 03/14 10:21:47 57
58 sleeping sa . . sns_acc2 AWAITING
COMMAND 5688 4 03/14 09:09:35 58
59 sleeping sa . . sns_acc2 AWAITING
COMMAND 6281 0 03/14 10:21:41 59
60 sleeping sa . . sns_acc2 AWAITING
COMMAND 17875 0 03/14 10:23:16 60
61 sleeping sa . 56 sns_acc2 INSERT
7516 0 03/14 10:35:18 61
62 RUNNABLE sa NAZAR . master SELECT
INTO 8719 0 03/14 10:36:30 SQL Query Analyzer 62
Please give me a solution to solve this and your email id pls.

> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||On Sun, 13 Mar 2005 23:19:02 -0800, shif wrote:

>Hi sir
>I forget the sp_lock i am adding here and it is lengthy upto 450 rows i
>deleted some rows.
Hi shif,
Thanks for posting the sp_lock output. Even though you deleted some
rows, I think you've left in the ones that count.

>if i have your mail id i can mail you the full text file.
Normally, I prefer to keep newsgroup help in the groups and reserve my
e-mail box for my loving mother, the usual load of spam and paying
customers. But I understand you don't want to post the full output here,
so go ahead - I'll allow it this time. My e-mail address is in the
headers of all my messages - you'll have to remove "_NO_" and "_SPAM_"
before using it (they are included to confuse the spam-bots).

>here is the sp_who2 and sp_lock
This output is even more clear that the previous output. Let's start
with the sp_who2 output. This row:

>SPID Status Login HostName BlkBy DBName Command CPUTime DiskIO LastBatch ProgramName SPID
>-- -- -- -- -- -- -- -- -- -- -- --
(snip)
>61 sleeping sa . 56 sns_acc2 INSERT 7516 0 03/14 10:35:18 61
shows that connection with SPID 61 is attempting an insert, but has to
wait. It is apparently attempting to acquire a lock on a resource that
is already locked by another application - one that currently holds SPID
56, as the entry "56" in the BlkBy columns proves.
And this row:
>SPID Status Login HostName BlkBy DBName Command CPUTime DiskIO LastBatch ProgramName SPID
>-- -- -- -- -- -- -- -- -- -- -- --
(snip)
>56 sleeping sa . . sns_acc2 AWAITING COMMAND 14906 25 03/14 10:28:29 56
shows that the blocking connection is currently not doing anything.
Now, let's take at the entries in the sp_lock output that belong to SPID
61:

>spid dbid ObjId IndId Type Resource Mode Status
>-- -- -- -- -- -- -- --
(snip)
>61 8 0 0 DB S GRANT
>61 8 1410104064 0 TAB IX WAIT
As you see, two locks only. One is granted, one is waiting. This one is
the cause of the blocking. It's a table lock, and the mode is IX
(intent-exclusive) - that means that the application needs to acquire an
exclusive lock on either one page or one row that's part of a table.
Since locks can always be upgraded to table locks, the right to do this
has to be reserved to prevent deadlocking.
To find out which table, use the values in dbid and ObjId. First, use
dbid to identify the database name:
SELECT db_name(8)
Then switch to the database returned by the previous query, and find the
name of the offending table:
USE <db-name goes here>
GO
SELECT object_name(1410104064)
My guess is that you'll find the database to be sns_acc2 and the table
to be ap_spled.
Finally, let's inspect the sp_lock output belonging to the blocking SPID
56. There's a whole lot of rows there. Most of them in dbid 2 (tempdb on
most, maybe even all installations). Only one in dbid 8, but it has the
same ObjId as in the previous row:

>spid dbid ObjId IndId Type Resource Mode Status
>-- -- -- -- -- -- -- --
(snip)
>56 8 1410104064 0 TAB S GRANT
And this one is the culprit. It's a shared table lock on the same table
that the insert statement needs to get an intent-exclusive lock on. A
shared lock is normally used for reading data - it allows others to read
simultaneously, but it disallows exclusive locks (used for data
modification), so that the data being read can't change. For obvious
reasons, the shared lock on this table is not compatible with the
requested intent-exclusive lock, so SPID 61 is put in a wait state until
the lock is released. For some reason, his doesn't happen. Until you
close the report generating application - then, either the application
closes the connection (committing or rolling back any open transactions)
or the connection gets dropped (incurring a forced rollback of the open
transactions). All locks held by SPID 56 are then released, and the
inserting applications finaly gets the lock it has been witing for :-)
The next step should be to inspect the code of the application that
generates the report. SQL Server's default behaviour is to release
shared locks directly after the SELECT statement has finished executing.
But that default behaviour can be changed. For a report generation that
queries the same table several times, it might be necessary to prevent
any modification between those queries, to prevent inconsistensies in
the report (simple example: report debit first, then report credit - if
any booking is inserted in between, the debit total won't match the
credit total and your bookkeeper will have a fit). In such cases, the
transaction isolation level is increased to either repeatable read or
serializable (this forces SQL Server to hold on to shared locks until
the transaction is finished). A transaction is started and all queries
needed to generate the report are run. The first query will acquire the
shared locks; they will be kept, so that no data can change until all
queries are finished. When the report is complete, the transaction is
committed, all locks are released and the report is presented to the
user (or printed, or stored, or whatever).
In your case, you should look for transactions that are started (with
BEGIN TRANSACTION), but not ended (with either ROLLBACK TRANSACTION or
COMMIT TRANSACTION). Note that some settings can cause an implicit BEGIN
TRANSACTION. Also note that the process should not need any user input
between the start and the end of the transaction, as users tend to go
away from the computer and drink some coffee, unaware that their failure
to click "OK" causes their collegues to be unable to work.
I hope the above is helpful in determining and fixing your problem!
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||HI
Again back,actualy the problem was in the stored procedure i am using an
update stmt,i checked by removing the update stmt
and the hanginh prblm for 2 days not happend hope it's ok and
thanks for your help.another thing if i want to include the update
stsmt in the procedure like this What i have to do.
update #pd_temp set dept_code = pay_hd.dept_code,inv_no = pay_hd.cheque_no
from pay_hd where #pd_temp.tr_no = pay_hd.tr_no and (#pd_temp.trans_type='PT'
OR #pd_temp.trans_type='PV')
This stmt is creating prblm,can i give any commit here.Can you please help
with a sample stmt.
Thank you
"Hugo Kornelis" wrote:

> On Sun, 13 Mar 2005 23:19:02 -0800, shif wrote:
>
> Hi shif,
> Thanks for posting the sp_lock output. Even though you deleted some
> rows, I think you've left in the ones that count.
>
> Normally, I prefer to keep newsgroup help in the groups and reserve my
> e-mail box for my loving mother, the usual load of spam and paying
> customers. But I understand you don't want to post the full output here,
> so go ahead - I'll allow it this time. My e-mail address is in the
> headers of all my messages - you'll have to remove "_NO_" and "_SPAM_"
> before using it (they are included to confuse the spam-bots).
>
> This output is even more clear that the previous output. Let's start
> with the sp_who2 output. This row:
> (snip)
> shows that connection with SPID 61 is attempting an insert, but has to
> wait. It is apparently attempting to acquire a lock on a resource that
> is already locked by another application - one that currently holds SPID
> 56, as the entry "56" in the BlkBy columns proves.
> And this row:
> (snip)
> shows that the blocking connection is currently not doing anything.
> Now, let's take at the entries in the sp_lock output that belong to SPID
> 61:
> (snip)
> As you see, two locks only. One is granted, one is waiting. This one is
> the cause of the blocking. It's a table lock, and the mode is IX
> (intent-exclusive) - that means that the application needs to acquire an
> exclusive lock on either one page or one row that's part of a table.
> Since locks can always be upgraded to table locks, the right to do this
> has to be reserved to prevent deadlocking.
> To find out which table, use the values in dbid and ObjId. First, use
> dbid to identify the database name:
> SELECT db_name(8)
> Then switch to the database returned by the previous query, and find the
> name of the offending table:
> USE <db-name goes here>
> GO
> SELECT object_name(1410104064)
> My guess is that you'll find the database to be sns_acc2 and the table
> to be ap_spled.
> Finally, let's inspect the sp_lock output belonging to the blocking SPID
> 56. There's a whole lot of rows there. Most of them in dbid 2 (tempdb on
> most, maybe even all installations). Only one in dbid 8, but it has the
> same ObjId as in the previous row:
> (snip)
> And this one is the culprit. It's a shared table lock on the same table
> that the insert statement needs to get an intent-exclusive lock on. A
> shared lock is normally used for reading data - it allows others to read
> simultaneously, but it disallows exclusive locks (used for data
> modification), so that the data being read can't change. For obvious
> reasons, the shared lock on this table is not compatible with the
> requested intent-exclusive lock, so SPID 61 is put in a wait state until
> the lock is released. For some reason, his doesn't happen. Until you
> close the report generating application - then, either the application
> closes the connection (committing or rolling back any open transactions)
> or the connection gets dropped (incurring a forced rollback of the open
> transactions). All locks held by SPID 56 are then released, and the
> inserting applications finaly gets the lock it has been witing for :-)
> The next step should be to inspect the code of the application that
> generates the report. SQL Server's default behaviour is to release
> shared locks directly after the SELECT statement has finished executing.
> But that default behaviour can be changed. For a report generation that
> queries the same table several times, it might be necessary to prevent
> any modification between those queries, to prevent inconsistensies in
> the report (simple example: report debit first, then report credit - if
> any booking is inserted in between, the debit total won't match the
> credit total and your bookkeeper will have a fit). In such cases, the
> transaction isolation level is increased to either repeatable read or
> serializable (this forces SQL Server to hold on to shared locks until
> the transaction is finished). A transaction is started and all queries
> needed to generate the report are run. The first query will acquire the
> shared locks; they will be kept, so that no data can change until all
> queries are finished. When the report is complete, the transaction is
> committed, all locks are released and the report is presented to the
> user (or printed, or stored, or whatever).
> In your case, you should look for transactions that are started (with
> BEGIN TRANSACTION), but not ended (with either ROLLBACK TRANSACTION or
> COMMIT TRANSACTION). Note that some settings can cause an implicit BEGIN
> TRANSACTION. Also note that the process should not need any user input
> between the start and the end of the transaction, as users tend to go
> away from the computer and drink some coffee, unaware that their failure
> to click "OK" causes their collegues to be unable to work.
> I hope the above is helpful in determining and fixing your problem!
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||On Thu, 17 Mar 2005 07:35:04 -0800, shif wrote:

>HI
>Again back,actualy the problem was in the stored procedure i am using an
>update stmt,i checked by removing the update stmt
>and the hanginh prblm for 2 days not happend hope it's ok and
>thanks for your help.another thing if i want to include the update
>stsmt in the procedure like this What i have to do.
>update #pd_temp set dept_code = pay_hd.dept_code,inv_no = pay_hd.cheque_no
>from pay_hd where #pd_temp.tr_no = pay_hd.tr_no and (#pd_temp.trans_type='PT'
>OR #pd_temp.trans_type='PV')
>This stmt is creating prblm,can i give any commit here.Can you please help
>with a sample stmt.
>Thank you
Hi shif,
You have completely lost me now. I just re-read our complete exchange.
First, you posted a stored procedure that creates a temp table #oi,
inserts some data from ap_spled into it, then selects some data from a
join of #oi and ap_spled. You also post an INSERT INTO ap_spled
statement that hangs after this procedure has run.
Now, you suddenly claim that you have removed an update statement that
updates #pd_temp based on data in pay_hd. How is that possible? How can
you remove a statement that never was there?
Anyway - did you already check the db_name and object_name I suggested
in my previous post? Did you inspect if the front-end code leaves any
transactions open? I still believe that to be the cause of your
problems. Fix your frontend to close the transaction after generating
the report and your problems will probably go away.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Hi
I am sorry ,actualy i had copied a differend update syntax but both having
same
effect.
thanks
update #out_inv set dept_code = pay_hd.dept_code,inv_no = pay_hd.cheq_no
from pay_hd
where #out_inv.tr_no = pay_hd.tr_no and
(#out_inv.trans_type='PT' OR #out_inv.trans_type='PV')
"Hugo Kornelis" wrote:

> On Thu, 17 Mar 2005 07:35:04 -0800, shif wrote:
>
> Hi shif,
> You have completely lost me now. I just re-read our complete exchange.
> First, you posted a stored procedure that creates a temp table #oi,
> inserts some data from ap_spled into it, then selects some data from a
> join of #oi and ap_spled. You also post an INSERT INTO ap_spled
> statement that hangs after this procedure has run.
> Now, you suddenly claim that you have removed an update statement that
> updates #pd_temp based on data in pay_hd. How is that possible? How can
> you remove a statement that never was there?
> Anyway - did you already check the db_name and object_name I suggested
> in my previous post? Did you inspect if the front-end code leaves any
> transactions open? I still believe that to be the cause of your
> problems. Fix your frontend to close the transaction after generating
> the report and your problems will probably go away.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||HI
Actualy i have posted is right only thing is that i have changed the table
name instead of #oi i put some other name.
"Hugo Kornelis" wrote:

> On Thu, 17 Mar 2005 07:35:04 -0800, shif wrote:
>
> Hi shif,
> You have completely lost me now. I just re-read our complete exchange.
> First, you posted a stored procedure that creates a temp table #oi,
> inserts some data from ap_spled into it, then selects some data from a
> join of #oi and ap_spled. You also post an INSERT INTO ap_spled
> statement that hangs after this procedure has run.
> Now, you suddenly claim that you have removed an update statement that
> updates #pd_temp based on data in pay_hd. How is that possible? How can
> you remove a statement that never was there?
> Anyway - did you already check the db_name and object_name I suggested
> in my previous post? Did you inspect if the front-end code leaves any
> transactions open? I still believe that to be the cause of your
> problems. Fix your frontend to close the transaction after generating
> the report and your problems will probably go away.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>

Thursday, February 16, 2012

Cannot get stored procedure to work

I am trying to pass a value from one stored procedure into another. I have got the following stored procedures:

Stored Procedure 1:

ALTER PROCEDUREtest2

(

@.Business_Namenvarchar(50)

)

AS

BEGIN

DECLARE@.Client_IDINT

SET NOCOUNT ON;

INSERT INTOclient_details(Business_Name)VALUES(@.Business_Name)

SELECT@.Client_ID =scope_identity()

IF@.@.NESTLEVEL = 1

SET NOCOUNT OFF

RETURN@.Client_ID

END

Stored Procedure 2 - Taking Client_ID from the proecedure test2

ALTER PROCEDUREdbo.test3

(

@.AddressLine1varchar(MAX),

@.Client_IDINT OUTPUT

)

AS

DECLARE@.NewClient_IDINT

EXECtest2 @.Client_ID = @.NewClient_IDOUTPUT

INSERT INTOclient_premises_address(Client_ID, AddressLine1)VALUES(@.Client_ID, @.AddressLine1)

SELECT@.NewClient_ID

When I run this proecedure I get the following error:

FailedProcedure or function 'test2' expects parameter '@.Business_Name', which was not supplied. Cannot insert the value NULL into column 'Client_ID', table 'C:\INETPUB\WWWROOT\SWWEBSITE\APP_DATA\SOUTHWESTSOLUTIONS.MDF.dbo.client_premises_address'; column does not allow nulls. INSERT fails. The statement has been terminated.

However If I run Stored Procedure Test2 on its own it runs fine

Can anyone help with this issue? Is there something that I have done wrong in my stored procedures?

Also does anyone know If I can use the second stored procedure in a second webpage, but get the value that was created by running the stored proecdure in the previous webpage?

Try to make two changes:

1. in your test2, move@.Client_ID to parameter section

@.Business_Namenvarchar(50),

@.Client_ID int = 0 OUTPUT

2. in your test3, change code as following:

EXEC test 2@.Business_Name, @.NewClient_IDOUTPUT --Here you need to pass @.Business_Name into test2 too.

Then,

INSERT INTOclient_premises_address(Client_ID, AddressLine1)VALUES(@.NewClient_ID , @.AddressLine1)

|||

try this

ALTER PROCEDUREtest2

(

@.Business_Namenvarchar(50)

@.Client_Id INToutput

)

AS

BEGIN

SET NOCOUNT ON;

INSERT INTOclient_details(Business_Name)VALUES(@.Business_Name)

SELECT@.Client_ID =scope_identity()

IF@.@.NESTLEVEL = 1

SET NOCOUNT OFF

END

Stored Procedure 2 - Taking Client_ID from the proecedure test2

ALTER PROCEDUREdbo.test3

(

@.AddressLine1varchar(MAX),

@.Client_IDINT OUTPUT

)

AS

DECLARE@.NewClient_IDINT

EXECtest2 @.NewClient_IDoutput

SET@.Client_ID=@.NewClient_ID

INSERT INTOclient_premises_address(Client_ID, AddressLine1)VALUES(@.Client_ID, @.AddressLine1)

SELECT@.NewClient_ID

Please try doing this, I am in hurry now, will explain you in detail later,

|||

If I change the @.Client_ID and put it in the paramter then when I do my insert, it gives me an error telling me that it needs me to pass in the parameter @.Client_ID, also it doesn't appear to like the change to the second procedure either, and says that I need to pass in the paramter Business_Name.

Do I need to change anything in my insert parameters within by sql datasource to get this working?

|||

Thanks for the suggestion Ritesh, I tried using this code, However I got the following error:

FailedProcedure or function 'test2' expects parameter '@.Client_Id', which was not supplied

Do I need to change anything In my parameters witin my sqldatasource??

|||

Please read my post again. 1).Because in your SP test2, you had @.Business_Name as parameter, you got to pass it in (Even though I don't know what it is). Ohterwise, you need to remove it. 2). After you move @.Client_ID to parameter section and set it as OUTPUT, you still need to pass it in in your test3 but set it as OUTPUT too.

|||

It doesn't like it when I pass @.Business_Name into the second procedure, I get the following:

FailedProcedure or function 'test3' expects parameter '@.Business_Name', which was not supplied.

This is the code, where my insert parameters are:

<asp:SqlDataSourceID="SqlDataSource1"runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

InsertCommand="test2"InsertCommandType="StoredProcedure">

<InsertParameters>

<asp:ControlParameterControlID="TextBoxBusinessName"Name="Business_Name"

PropertyName="Text"Type="String"/>

<asp:ParameterDirection="Output"Name="Client_ID"Type="Int32"/>

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSourceID="SqlDataSource3"runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

InsertCommand="test3"InsertCommandType="StoredProcedure">

<InsertParameters>

<asp:ControlParameterControlID="TextBoxAddressLine1"Name="AddressLine1"

PropertyName="Text"Type="String"/>

<asp:ParameterDirection="Output"Name="Client_ID"Type="Int32"/>

</InsertParameters>

</asp:SqlDataSource>

|||

I asked you to pass @.Business_Name to test3 because I saw you had it as Paramater. But, from your test2, I didn't see you pass it in as Parameter. I am not sure why you had this parameter for test2. Now, this error was caused because the code in test3

EXEC test2 @.Business_Name, @.NewClientID OUTPUT.

If you don't need to pass @.Business_Name into test2 from your test3, you can do

EXEC test2 '', @.NewClientID OUTPUT

Not sure that is your purpose or not.

|||ALTER PROCEDUREtest2

(

@.Business_Namenvarchar(50)

@.Client_Id INToutput

)

AS

BEGIN

SET NOCOUNT ON;

INSERT INTOclient_details(Business_Name)VALUES(@.Business_Name)

SELECT@.Client_ID =scope_identity()

IF@.@.NESTLEVEL = 1

SET NOCOUNT OFF

END

Stored Procedure 2 - Taking Client_ID from the proecedure test2

ALTER PROCEDUREdbo.test3

(

@.AddressLine1varchar(MAX),

@.Client_IDINT OUTPUT

)

AS

DECLARE@.NewClient_IDINT

EXECtest2 @.business_name,@.NewClient_IDoutput -- forgot to pass bussiness name

SET@.Client_ID=@.NewClient_ID

INSERT INTOclient_premises_address(Client_ID, AddressLine1)VALUES(@.Client_ID, @.AddressLine1)

SELECT@.NewClient_ID

--------

EXECtest2 @.business_name,@.NewClient_IDoutput -- forgot to pass bussiness name

please pass this parameter and try again

|||

Do I still need to pass @.Business_Name even though it is not needed in the cient_premises_address table?

The only variable which I wish to pass in from the first procedure is @.Client_ID which is a foreign key in the client_premises_address table

Sorry Im very new to this, so it is taking me a while to grasp

Cannot get Stored Procedure parameters in SMO

Hi ,

I have tried it all and I cannot seem to get the stored Procedure parameters

StoredProcedure sp=new StoredProcedure (mActiveDatabase,spName);

foreach (StoredProcedureParameter spParam in sp.Parameters) {

string fldName = spParam.Name;

}

Now I can see in the Debug Visualizer the spName and other properties

however the parameter.count is 0 even though I know for a fact i have 3 parameters.

Why is not getting them?Bug in SMO or AM I missing something.

Using reflection I get them!!

thanks in advance for your replies.

I modified procedure AfterSelect of smoBrowser.vb in the SMOBrowse sample program as shown below to dump the parameters of the selected stored procedure in the object treeview. It seems to work file:

00129Private Sub AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs)

Handles objectTreeView.AfterSelect

00130Dim oldCursor As Cursor = Me.Cursor

00131Me.Cursor = Cursors.WaitCursor

00132

00133Try

00134Me.propertyGrid1.SelectedObject = e.Node.Tag

00135

00136' *********************************************

00137' * If the node clicked is a stored procedure

00138' * then debug its parameters

00139' *********************************************

00140If TypeOf e.Node.Tag Is StoredProcedure Then

00141Dim p As Parameter

00142Dim sp As StoredProcedure

00143sp = CType(e.Node.Tag, StoredProcedure)

00144

00145

00146For Each p In sp.Parameters

00147Debug.WriteLine(p.Name & " " & p.DataType.ToString)

00148Next

00149

00150End If

00151

00152If TypeOf e.Node.Tag Is IScriptable Then

00153Me.textBox1.Text = GetScriptText(CType(e.Node.Tag, IScriptable))

00154Else

00155Me.textBox1.Text = String.Empty

00156End If

00157

00158Catch ex As SmoException

00159Dim emb As New ExceptionMessageBox(ex)

00160emb.Show(Me)

00161Finally

00162Me.Cursor = oldCursor

00163End Try

00164End Sub

Regards,
Joginder Nahil
www.starprint2000.com

|||

You are a star!!!

You are helping me so much thanks!

One question

To assign an image to the node in smoBrowser did you modify "CreateNode"

and depending on the item you assign the relative picture?Is this how you did it?

Thanks again

|||

Not a problem.

That is exacltly what I did. I took the images from SQL Server Management Studio.

Regards,
Joginder Nahil
www.starprint2000.com

Sunday, February 12, 2012

Cannot find either column "dbo" or the user-defined function

Hi,

I have a stored procedure that calls a scalar function. It works fine on my development database, but on my production database, I get this error when trying to execute the procedure:

Cannot find either column "dbo" or the user-defined function or aggregate "dbo.MyFunction", or the name is ambiguous.

However, I am able to execute the function outside of the procedure like this: select dbo.MyFunction(0, 0)

Anyone have idea? I can't figure it out.

Make sure that you have deployed the function ins the right DataBase from which you want to access...Some time this happens that the function will be deployed to a different DataBase or to the master DB by mistake.Also make sure that you grant the exeute permission on function to the user with which you currently trying to execute

|||

Thanks for the reply. It's definitely in the right database, I see it when I run

SELECT * FROM INFORMATION_SCHEMA.Routines

I'm pretty sure the permissions are OK, I am able to execute the function in a SQL query, but it's not working when I execute a stored procedure that uses it.

Any other ideas?

|||

Can u post the code you've written in the sproc and function?

|||

Yes, here it is:

set ANSI_NULLSONset QUOTED_IDENTIFIERONgoCREATE FUNCTION [dbo].[DistanceBetweenTEST]()RETURNSfloatASBEGIN-- test codereturn 10.2345ENDCREATE PROCEDURE [dbo].[md_UserSearchTEST]ASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from-- interfering with SELECT statements.SET NOCOUNT ON;-- test codeSELECT1WHERE dbo.md_DistanceBetweenTEST() > 5END-- this returns a value as expectedselect dbo.DistanceBetweenTEST()-- this throws an exceptionexec md_UserSearchTEST/*Msg 4121, Level 16, State 1, Procedure md_UserSearchTEST, Line 10Cannot find either column "dbo" or the user-defined function or aggregate "dbo.md_DistanceBetweenTEST", or the name is ambiguous.*/
|||

What exactly are you trying to do? Your function name is DistanceBetweenTEST, but you are calling it withmd_DistanceBetweenTEST? You got it all messed up. Explain what you are trying to do so we can help.

|||

WOW. I don't know why I didn't see that. That was the problem right there.

I think I've been looking at this for too long. Thanks.

Cannot find columns from a stored procedure...

I have an application that I inherited, and I have a annoying problem. We're using stored procedures to return most of our data, and occasionally we receive errors stating that a particular column cannot be found in the resulting data table. When I run the stored procedure against SQL Server I receive the expected output. What would make this random act happen, any ideas?

Also, I keep receiving errors stating that a connection is already open and needs to be closed before an action to the database is performed. I'm explicitly closing each connection in a finally block for every method in my data access code, so a connection should always be closed, right?

Does the code the runs the stored procedure site inside a try...catch, if so make the catch log the parameter that were supplied to the stored procedure. Also I would log the number of rows in the datatable. This should allow the problem to be reproduced.

>before an action to the database is performed
What action(s) give rise to this message.

For completeness, which version of SQL Server and ASP.NET are you using?

|||

Here is an example of the code:


SqlDataAdapter da = new SqlDataAdapter("GetWFSAInfo",SQLcn);
DataSet ds = new DataSet();
da.SelectCommand.Parameters.Add("@.WFSAID",SqlDbType.Int).Value = WFSAID;
da.SelectCommand.CommandType = CommandType.StoredProcedure;

try {
da.Fill(ds,"GetWFSAInfo");
}
catch (Exception ex) {
NotifyOfException (ex);
}
finally {
SQLcn.Close();
}

return ds;

Originally, none of this code was in try/catch/finally blocks at all, so I had to weed through over 11,000 lines of data access code to put these constructs in. That seems to curb some of the problems. I prefer to use a class library that I created that takes care of all of this for me. I swear, object orientation, inheritance and the like and the previous programmer were never introduced. Aggravating to say the least...

NotifyOfException logs the exception to a log file. I am using SQL Server 2000/ASP.NET 1.1.

Thanks for all of your help...

|||

You will need to modify the catch

catch (Exception ex) {
NotifyOfException (ex);
}

to

catch (Exception ex) {
ex.Data = WFSAID;
NotifyOfException (ex);
}

This assumes of course that WFSAID is a variable.

Friday, February 10, 2012

Cannot find stored procedure

I developed a ASP.net web application with a MSDE database backend on my laptop(vs.net 2003 XP Pro), then I transferred the website onto a server(Windows Server 2003) and generated a SQL Server 2000 database from the scripts I exported from MSDE(web administrator). The problem I am having is that it can't find any stored procedures. I keep getting errors when logging on, 'Could not find stored procedure "_myProc" '.
Any one with any clues what might be the problem?
Yes I have changed the connection strings.
Thanks in advance
PPerhaps the owner of the SP is not what you expect? I have not used web_administrator, but perhaps it does not prefix SPs scripted with dbo., and so the SPs are owned by a different user.|||My Error, SP is case sensitive and somehow during the transfer of the site and DB one letter in SP name was changed to upper case. Buggered if I know how.
Have a great weekend Doug
Thanks for the help
Pete

Cannot find sp_repladdcolumn stored procedure.

I have merge replication set up on several database tables. I was reading
about using sp_repladdcolumn and sp_repldropcolumn to make modification to
the schema since it cannot be done directly with the alter table command.
However, I cannot find either of these store procedures in the list for this
database. I do see several sp_ followed by a long cryptic looking name
comprised of lettes and numbers.
Should the sp_repldropcolumn and sp_repladdcolumn be showing up on a merge
replicated database? If so, do you know of why these are not showing up?
Thanks,
Bill Mitchell
they are in the master database on all SQL Server 2000 systems.
"Bill Mitchell" <bill.mitchell@.jjindustries.com> wrote in message
news:u5M5LEDREHA.1340@.TK2MSFTNGP12.phx.gbl...
> I have merge replication set up on several database tables. I was reading
> about using sp_repladdcolumn and sp_repldropcolumn to make modification to
> the schema since it cannot be done directly with the alter table command.
> However, I cannot find either of these store procedures in the list for
this
> database. I do see several sp_ followed by a long cryptic looking name
> comprised of lettes and numbers.
> Should the sp_repldropcolumn and sp_repladdcolumn be showing up on a merge
> replicated database? If so, do you know of why these are not showing up?
> Thanks,
> Bill Mitchell
>
|||Thanks Hilary! I am just learning SQL Server and was sure I had corrupted
something in my database.
Bill
"Hilary Cotter" <hilaryk@.att.net> wrote in message
news:u3qr33EREHA.2716@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> they are in the master database on all SQL Server 2000 systems.
> "Bill Mitchell" <bill.mitchell@.jjindustries.com> wrote in message
> news:u5M5LEDREHA.1340@.TK2MSFTNGP12.phx.gbl...
reading[vbcol=seagreen]
to[vbcol=seagreen]
command.[vbcol=seagreen]
> this
merge[vbcol=seagreen]
up?
>

Cannot find sp_add_jobstep store procedure

Hello All,
Could someone show me where I can find "sp_add_jobstep" store procedure? I can't find it in my SQL2000.
Thanks,
Tuoc
It's in the msdb database.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Tuoc" <anonymous@.discussions.microsoft.com> wrote in message
news:E7C201A1-334C-4DCE-B6F3-8296AA924334@.microsoft.com...
Hello All,
Could someone show me where I can find "sp_add_jobstep" store procedure? I
can't find it in my SQL2000.
Thanks,
Tuoc

Cannot find sp_add_jobstep store procedure

Hello All
Could someone show me where I can find "sp_add_jobstep" store procedure? I can't find it in my SQL2000
Thanks
TuocIt's in the msdb database.
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Tuoc" <anonymous@.discussions.microsoft.com> wrote in message
news:E7C201A1-334C-4DCE-B6F3-8296AA924334@.microsoft.com...
Hello All,
Could someone show me where I can find "sp_add_jobstep" store procedure? I
can't find it in my SQL2000.
Thanks,
Tuoc

Cannot find sp_add_jobstep store procedure

Hello All,
Could someone show me where I can find "sp_add_jobstep" store procedure? I c
an't find it in my SQL2000.
Thanks,
TuocIt's in the msdb database.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Tuoc" <anonymous@.discussions.microsoft.com> wrote in message
news:E7C201A1-334C-4DCE-B6F3-8296AA924334@.microsoft.com...
Hello All,
Could someone show me where I can find "sp_add_jobstep" store procedure? I
can't find it in my SQL2000.
Thanks,
Tuoc

Cannot find select stored procedure wizard in SQL 2000

I was using the SQL 2000 stored procedure wizard to create stored
procedures. I can create insert, delete and update SPs however I am
not able to create the select SP. The wizard does not offer the option
of selecting "select" type SP. thank you for your replys

comprajHi

Select is not supported through the CREATE PROCEDURE wizard. Try using Query
Analyser and the CREATE PROCEDURE statement described in books online.

http://msdn.microsoft.com/library/d...create_4hk5.asp

If you require select statements for a given table you can right click the
table in object browser and script the select statement to a new window.

John

"compraj" <rajeshgambhir@.hotmail.com> wrote in message
news:b3cb283a.0310220207.12c76283@.posting.google.c om...
> I was using the SQL 2000 stored procedure wizard to create stored
> procedures. I can create insert, delete and update SPs however I am
> not able to create the select SP. The wizard does not offer the option
> of selecting "select" type SP. thank you for your replys
> compraj