Showing posts with label state. Show all posts
Showing posts with label state. Show all posts

Friday, March 23, 2012

QUERY

QUERY
select enddate EDT
NEW_TIME(ENDDATE, 'EDT','PDT'
FROM PROJEC
ERROR
Server: Msg 195, Level 15, State 10, Line
'NEW_TIME' is not a recognized function nameRMSANDS (whoever you are)
You are posting many functions that are not defined in SQL-Server. You
are probably converting code from a different RDBMS.
You should really explain what each function is supposed to do. In
addition to that, it wouldn't hurt to take a look at the SQL-Server
Books Online (a download link has been posted by Ray Higdon) to see what
functions SQL-Server does support.
Gert-Jan
RMSANDS wrote:
> QUERY:
> select enddate EDT,
> NEW_TIME(ENDDATE, 'EDT','PDT')
> FROM PROJECT
> ERROR:
> Server: Msg 195, Level 15, State 10, Line 2
> 'NEW_TIME' is not a recognized function name.
--
(Please reply only to the newsgroup)

Query

Using sql 2000
Query
SELECT enddate,last_day(enddate
FROM Project;
Error
Server: Msg 195, Level 15, State 10, Line
'last_day' is not a recognized function nameWhat is last_day? Is enddate the column and you want the max value? If so,
SELECT max(enddate)
FROM Project
HTH
--
Ray Higdon MCSE, MCDBA, CCNA
--
"rmsands" <anonymous@.discussions.microsoft.com> wrote in message
news:43EAC36D-FC2A-4616-B2EE-2F9EE97E915A@.microsoft.com...
> Using sql 2000:
> Query:
> SELECT enddate,last_day(enddate)
> FROM Project;
> Error:
> Server: Msg 195, Level 15, State 10, Line 1
> 'last_day' is not a recognized function name.
>
>|||If your last_day is a user defined function you need to put the owner in
front of it
SELECT enddate,dbo.last_day(enddate)
FROM Project;
--
Dandy Weyn, Belgium
MCSE, MCSA, MCDBA, MCT
http://www.dandyman.net
Check my SQL Server resource pages (currently under construction)
http://www.dandyman.net/sql
"Ray Higdon" <sqlhigdon@.nospam.yahoo.com> wrote in message
news:uaj1z9X#DHA.3816@.tk2msftngp13.phx.gbl...
> What is last_day? Is enddate the column and you want the max value? If so,
> SELECT max(enddate)
> FROM Project
> HTH
> --
> Ray Higdon MCSE, MCDBA, CCNA
> --
> "rmsands" <anonymous@.discussions.microsoft.com> wrote in message
> news:43EAC36D-FC2A-4616-B2EE-2F9EE97E915A@.microsoft.com...
> > Using sql 2000:
> >
> > Query:
> >
> > SELECT enddate,last_day(enddate)
> > FROM Project;
> >
> > Error:
> >
> > Server: Msg 195, Level 15, State 10, Line 1
> > 'last_day' is not a recognized function name.
> >
> >
> >
>|||I WANT TO KNOW WHAT THE LAST DAY OF THE MONTH IS IN THE COLUMN ENDDATE.|||Date of the last day of the month of Enddate:
SELECT DATEADD(MONTH,1,DATEADD(DAY,-DAY(enddate),enddate))
FROM Project
Last day of the month of Enddate:
SELECT DAY(DATEADD(MONTH,1,DATEADD(DAY,-DAY(enddate),enddate)))
FROM Project
--
David Portas
SQL Server MVP
--

Query

Using sql 2000:
Query:
SELECT enddate,last_day(enddate)
FROM Project;
Error:
Server: Msg 195, Level 15, State 10, Line 1
'last_day' is not a recognized function name.What is last_day? Is enddate the column and you want the max value? If so,
SELECT max(enddate)
FROM Project
HTH
Ray Higdon MCSE, MCDBA, CCNA
--
"rmsands" <anonymous@.discussions.microsoft.com> wrote in message
news:43EAC36D-FC2A-4616-B2EE-2F9EE97E915A@.microsoft.com...
> Using sql 2000:
> Query:
> SELECT enddate,last_day(enddate)
> FROM Project;
> Error:
> Server: Msg 195, Level 15, State 10, Line 1
> 'last_day' is not a recognized function name.
>
>|||If your last_day is a user defined function you need to put the owner in
front of it
SELECT enddate,dbo.last_day(enddate)
FROM Project;
--
Dandy Weyn, Belgium
MCSE, MCSA, MCDBA, MCT
http://www.dandyman.net
Check my SQL Server resource pages (currently under construction)
http://www.dandyman.net/sql
"Ray Higdon" <sqlhigdon@.nospam.yahoo.com> wrote in message
news:uaj1z9X#DHA.3816@.tk2msftngp13.phx.gbl...
> What is last_day? Is enddate the column and you want the max value? If so,
> SELECT max(enddate)
> FROM Project
> HTH
> --
> Ray Higdon MCSE, MCDBA, CCNA
> --
> "rmsands" <anonymous@.discussions.microsoft.com> wrote in message
> news:43EAC36D-FC2A-4616-B2EE-2F9EE97E915A@.microsoft.com...
>|||I WANT TO KNOW WHAT THE LAST DAY OF THE MONTH IS IN THE COLUMN ENDDATE.|||Date of the last day of the month of Enddate:
SELECT DATEADD(MONTH,1,DATEADD(DAY,-DAY(enddate),enddate))
FROM Project
Last day of the month of Enddate:
SELECT DAY(DATEADD(MONTH,1,DATEADD(DAY,-DAY(enddate),enddate)))
FROM Project
David Portas
SQL Server MVP
--sql

QUERY

QUERY:
select enddate EDT,
NEW_TIME(ENDDATE, 'EDT','PDT')
FROM PROJECT
ERROR:
Server: Msg 195, Level 15, State 10, Line 2
'NEW_TIME' is not a recognized function name.RMSANDS (whoever you are)
You are posting many functions that are not defined in SQL-Server. You
are probably converting code from a different RDBMS.
You should really explain what each function is supposed to do. In
addition to that, it wouldn't hurt to take a look at the SQL-Server
Books Online (a download link has been posted by Ray Higdon) to see what
functions SQL-Server does support.
Gert-Jan
RMSANDS wrote:
> QUERY:
> select enddate EDT,
> NEW_TIME(ENDDATE, 'EDT','PDT')
> FROM PROJECT
> ERROR:
> Server: Msg 195, Level 15, State 10, Line 2
> 'NEW_TIME' is not a recognized function name.
(Please reply only to the newsgroup)

Wednesday, March 21, 2012

Queries going to Suspend state with wait type ASYNC_NETWORK_IO

Recently we observed a problem. We are running stored procedure through our c# code. Three machines access the server and update or insert in the required tables in the server. If there is no data in the server, on installing first time our application usually our database is clean. then stored procedure works fine, it takes around 10 to 15 sec to execute. Next time if execute the time goes up to minutes like 15 mins. Next time it goes for hours around 4 hrs. Even to update 4 or 5 records it takes time. Initially we thought it was because of the size of the data and we tried to re tune on indexes, it did not solve. But now what we observe is even with less number of records in server also it wouldn't come of the execution for hours.
Now are executing the just the SP in the SQL manager studio to see the time. That one also is executing for hours. when looked at the activity monitor the process goes to suspend state with wait type ASYNC_NETWORK_IO.

When we comment one of the query is working fine.
Is this something to do with the query I am not sure. If that is the case it should not work every time.

The query makes any sence or is there any way to write it in better way

'UPDATE [server].[dbo].[DocumentMetadata] SET DocumentInfoID = b.DocumentInfoID, [Name] = b.[Name], MetadataType = b.MetadataType,
[Value] = b.[Value], ValueType = b.ValueType
FROM [server].[dbo].[DocumentMetadata] a WITH (UPDLOCK)
INNER JOIN (SELECT c.DocumentInfoID, c.[Name], c.MetadataType, c.[Value], c.ValueType
FROM MACHINENAME.[Client].[dbo].[DocumentMetadata] c
INNER JOIN MACHINENAME.[Client].dbo.DocumentInfo DINF ON c.DocumentInfoID = DINF.DocumentInfoID
INNER JOIN MACHINENAME.[Client].dbo.Path d on DINF.NativeFileID = d.PathID
INNER JOIN MACHINENAME.[Client].dbo.ActiveDataSource ADS ON d.DataSourceID = ADS.DataSourceID
WHERE ADS.ProjectID = ''' + @.ProjID + ''') b
ON a.DocumentInfoID = b.DocumentInfoID AND a.[Name] = b.[Name]'

'INSERT INTO [server].[dbo].[DocumentMetadata]
(DocumentInfoID, [Name], MetadataType, [Value], ValueType)
SELECT c.DocumentInfoID, c.[Name], c.MetadataType, c.[Value], c.ValueType
FROM MACHINENAME.[Client].[dbo].[DocumentMetadata] c
INNER JOIN MACHINENAME.[Client].dbo.DocumentInfo DINF ON c.DocumentInfoID = DINF.DocumentInfoID
INNER JOIN MACHINENAME.[Client].dbo.Path d on DINF.NativeFileID = d.PathID
INNER JOIN MYCLI.[Client].dbo.ActiveDataSource ADS ON d.DataSourceID = ADS.DataSourceID
WHERE ADS.ProjectID = ''' + @.ProjID + '''
AND Ltrim(rtrim(c.DocumentInfoID))+ ltrim(rtrim(c.[Name])) NOT IN
(SELECT Ltrim(rtrim(DocumentInfoID))+ ltrim(rtrim([Name])) FROM [server].[dbo].[DocumentMetadata])'

We have been fighting it out for so many days.
Can anybody help

Thanks
knvdssr

ASYNC_NETWORK_IO means SQL server is waiting for network...

How may rows your select statement for INSERT it is returning?

You are using ltrim and rtrim functions against column which result a table scan and it can't use index...

Try to change the query or just comment the query and test it to make it is the issue.

|||It appears you are using a LINKED SERVER to access another server?

If this is the case, try looking at activity monitor on the source. I would suspect you are getting a deadlock or lock problem or something on the linked server.

The wait you are seeing indicates it is waiting on the linked server to finish the query and send records.

|||When you use 4-part name, all of the data from the remote server is pulled across before the join is formulated. If the remote table is large, you will have to wait for a long time for all the data to cross over. Try using openquery() to only pull/update the necessary remote data.

You can lookup some examples here:
http://groups.google.com/groups?q=sqlserver%20oj%20openquery%20update|||

We commented the query which I mentioned earlier, to see if that one is causing the problem. Then the whole Stored procedure finished executing in minutes.

We changed the the query with our using the NOT IN in that query.

Now first time it is taking only 10 minutes for more than 100,000 records.

But the second one is not coming out at all. This time the server is having lot of rows because is already updated once.

All that we see is the process in suspend state or comes out as timed out.

If I am getting a dead lock on the linked server is there any way to solve it?

Could any body help please

|||

Again, take a look at openquery/openrowset. Bringing the entire resultset back is not recommended when the remote table is large.

Friday, March 9, 2012

QA simple question

Hi
I'm a new MS SQL user. When I'm using QA it shows erros in such a way:
"Server: Msg 156, Level 15, State 1, Procedure XX_IMPORT, Line 45
Incorrect syntax near the keyword 'select'."
I wonder how to force it to show correct line. In the example above I
checked line 45 and there is no "select" statement.
I suspect that it ignores lines with comments and blank lines. So debugging
where the error occurs is very difficult.
Best Regards
(and sorry for the simplicity of the question)
Darek T.Dariusz Tomon,
Go to the messages window and double click over the error message. QA will
take you directly to the line where the error is.
AMB
"Dariusz Tomon" wrote:
> Hi
> I'm a new MS SQL user. When I'm using QA it shows erros in such a way:
> "Server: Msg 156, Level 15, State 1, Procedure XX_IMPORT, Line 45
> Incorrect syntax near the keyword 'select'."
> I wonder how to force it to show correct line. In the example above I
> checked line 45 and there is no "select" statement.
> I suspect that it ignores lines with comments and blank lines. So debugging
> where the error occurs is very difficult.
> Best Regards
> (and sorry for the simplicity of the question)
> Darek T.
>
>|||Hi Darek
You can double-click on the error message, and QA will take you to the line
in the Query Window where the error is.
--
HTH
Kalen Delaney, SQL Server MVP
"Dariusz Tomon" <d.tomon@.mazars.pl> wrote in message
news:esH%23a97jGHA.4884@.TK2MSFTNGP03.phx.gbl...
> Hi
> I'm a new MS SQL user. When I'm using QA it shows erros in such a way:
> "Server: Msg 156, Level 15, State 1, Procedure XX_IMPORT, Line 45
> Incorrect syntax near the keyword 'select'."
> I wonder how to force it to show correct line. In the example above I
> checked line 45 and there is no "select" statement.
> I suspect that it ignores lines with comments and blank lines. So
> debugging where the error occurs is very difficult.
> Best Regards
> (and sorry for the simplicity of the question)
> Darek T.
>
>|||"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:95A3E7C1-AAAA-46B6-BEAC-74AE111023E4@.microsoft.com...
> Dariusz Tomon,
> Go to the messages window and double click over the error message. QA will
> take you directly to the line where the error is.
>
> AMB
Thank you - I did not know that it's so simple :)
>
> "Dariusz Tomon" wrote:
>> Hi
>> I'm a new MS SQL user. When I'm using QA it shows erros in such a way:
>> "Server: Msg 156, Level 15, State 1, Procedure XX_IMPORT, Line 45
>> Incorrect syntax near the keyword 'select'."
>> I wonder how to force it to show correct line. In the example above I
>> checked line 45 and there is no "select" statement.
>> I suspect that it ignores lines with comments and blank lines. So
>> debugging
>> where the error occurs is very difficult.
>> Best Regards
>> (and sorry for the simplicity of the question)
>> Darek T.
>>
>>|||"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:umPIQL8jGHA.1640@.TK2MSFTNGP02.phx.gbl...
> Hi Darek
> You can double-click on the error message, and QA will take you to the
line
> in the Query Window where the error is.
Dang, in all these years, I never realized that.
Thanks.
> --
> HTH
> Kalen Delaney, SQL Server MVP
>
> "Dariusz Tomon" <d.tomon@.mazars.pl> wrote in message
> news:esH%23a97jGHA.4884@.TK2MSFTNGP03.phx.gbl...
> > Hi
> >
> > I'm a new MS SQL user. When I'm using QA it shows erros in such a way:
> >
> > "Server: Msg 156, Level 15, State 1, Procedure XX_IMPORT, Line 45
> > Incorrect syntax near the keyword 'select'."
> >
> > I wonder how to force it to show correct line. In the example above I
> > checked line 45 and there is no "select" statement.
> > I suspect that it ignores lines with comments and blank lines. So
> > debugging where the error occurs is very difficult.
> >
> > Best Regards
> > (and sorry for the simplicity of the question)
> >
> > Darek T.
> >
> >
> >
>

QA Debugger

I need help resolving a problem our developers are having with Query Analyzer
debugger. They get an error "Server: Msg 504, Level 16, State 1, Procedure
sp_sdidebug, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect to debugger
on SALESTEMP (Error = 0x800706ba). Ensure that client-side components, such
as SQLDBREG.EXE, are installed and registered on <local pc name>. Debugging
disabled for connection 63." when they attempt to debug stored procedures.
Does anyone have any suggestions?You want to start with the steps in the article in books
online for: Troubleshooting the Transact-SQL Debugger
In addition, if you are using SQL Server 2000 SP 3 you will
want to refer to the following article:
The T-SQL Debugger is turned off by default for earlier
clients after you install SQL Server 2000 Service Pack 3
http://support.microsoft.com/?id=328151
-Sue
On Fri, 14 Jan 2005 06:19:10 -0800, "Ray Kurpiel"
<RayKurpiel@.discussions.microsoft.com> wrote:
>I need help resolving a problem our developers are having with Query Analyzer
>debugger. They get an error "Server: Msg 504, Level 16, State 1, Procedure
>sp_sdidebug, Line 1
>[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect to debugger
>on SALESTEMP (Error = 0x800706ba). Ensure that client-side components, such
>as SQLDBREG.EXE, are installed and registered on <local pc name>. Debugging
>disabled for connection 63." when they attempt to debug stored procedures.
>Does anyone have any suggestions?
>

QA Debugger

I need help resolving a problem our developers are having with Query Analyze
r
debugger. They get an error "Server: Msg 504, Level 16, State 1, Procedure
sp_sdidebug, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect
to debugger
on SALESTEMP (Error = 0x800706ba). Ensure that client-side components, such
as SQLDBREG.EXE, are installed and registered on <local pc name>. Debugging
disabled for connection 63." when they attempt to debug stored procedures.
Does anyone have any suggestions?You want to start with the steps in the article in books
online for: Troubleshooting the Transact-SQL Debugger
In addition, if you are using SQL Server 2000 SP 3 you will
want to refer to the following article:
The T-SQL Debugger is turned off by default for earlier
clients after you install SQL Server 2000 Service Pack 3
http://support.microsoft.com/?id=328151
-Sue
On Fri, 14 Jan 2005 06:19:10 -0800, "Ray Kurpiel"
<RayKurpiel@.discussions.microsoft.com> wrote:

>I need help resolving a problem our developers are having with Query Analyz
er
>debugger. They get an error "Server: Msg 504, Level 16, State 1, Procedure
>sp_sdidebug, Line 1
>[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connec
t to debugger
>on SALESTEMP (Error = 0x800706ba). Ensure that client-side components, such
>as SQLDBREG.EXE, are installed and registered on <local pc name>. Debugging
>disabled for connection 63." when they attempt to debug stored procedures.
>Does anyone have any suggestions?
>

QA Debugger

I need help resolving a problem our developers are having with Query Analyzer
debugger. They get an error "Server: Msg 504, Level 16, State 1, Procedure
sp_sdidebug, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect to debugger
on SALESTEMP (Error = 0x800706ba). Ensure that client-side components, such
as SQLDBREG.EXE, are installed and registered on <local pc name>. Debugging
disabled for connection 63." when they attempt to debug stored procedures.
Does anyone have any suggestions?
You want to start with the steps in the article in books
online for: Troubleshooting the Transact-SQL Debugger
In addition, if you are using SQL Server 2000 SP 3 you will
want to refer to the following article:
The T-SQL Debugger is turned off by default for earlier
clients after you install SQL Server 2000 Service Pack 3
http://support.microsoft.com/?id=328151
-Sue
On Fri, 14 Jan 2005 06:19:10 -0800, "Ray Kurpiel"
<RayKurpiel@.discussions.microsoft.com> wrote:

>I need help resolving a problem our developers are having with Query Analyzer
>debugger. They get an error "Server: Msg 504, Level 16, State 1, Procedure
>sp_sdidebug, Line 1
>[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect to debugger
>on SALESTEMP (Error = 0x800706ba). Ensure that client-side components, such
>as SQLDBREG.EXE, are installed and registered on <local pc name>. Debugging
>disabled for connection 63." when they attempt to debug stored procedures.
>Does anyone have any suggestions?
>

Q319697

SQL Enterprise Manager Restore to Point in Time Does Not
Stop at Requested Time
and the Database is Left in a Loading State 'Q319697'
Has anybody had problems similar to the one high-lighted
in Q319697.
Earlier this week I tried to Recover a database to a
specific point in time
but the restore went to the end of the file.
I have SP3 and MS03-031 hot fix installed both on my PC
and the server I was restoring to.
The Knowledge base article says that it is fixed in SP3,
has MS03-031 caused this?
After the initial panic I managed to restore the database
using SQL.
GaryI have the same problem that you describe even if I have SP3 installed.. Th
is is not related to MS03-031 hot fix because I don't have installed this on
e

Q319697

SQL Enterprise Manager Restore to Point in Time Does Not
Stop at Requested Time
and the Database is Left in a Loading State 'Q319697'
Has anybody had problems similar to the one high-lighted
in Q319697.
Earlier this week I tried to Recover a database to a
specific point in time
but the restore went to the end of the file.
I have SP3 and MS03-031 hot fix installed both on my PC
and the server I was restoring to.
The Knowledge base article says that it is fixed in SP3,
has MS03-031 caused this?
After the initial panic I managed to restore the database
using SQL.
GaryI have the same problem that you describe even if I have SP3 installed.. This is not related to MS03-031 hot fix because I don't have installed this one