Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000] String data, right truncation [SQLSTATE 01004] [SQLSTATE 08S01] error
I'm looking for some general guidance on this complete error:
Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000]
String data, right truncation [SQLSTATE 01004]
Msg 16389, Sev 16, State 1: The connection is no longer usable because the server response for a previously executed statement was incorrectly formatted. [SQLSTATE 08S01]
This error is caused by a SQL Agent Job, but it does not always occur. I understand this could be an issue with SQL dropping the connection, but what is the best way to troubleshoot this?
Thanks,
Phil
Hi philliptackett77,
It would be more helpful for troubleshooting the issue if you post the SQL Server error log and SQL Server version. Additionally, please state what purpose of using the agent job.
Based on my research, [SQLSTATE 08S01] error means communication link failure. If the executed statement returns invalid value in the job, the connection between server and client will fail. This error could be caused by the error of [SQLSTATE HY000] and
[SQLSTATE 01004]. I’d like to share my knowledge about these errors as below.
Quote: String data, right truncation [SQLSTATE 01004]
This error could occur when passing data whose length is larger than the received object,and the passed value is truncated, and returns invalid value. So please check if the data type of the objects are identical and the length of passed value is not larger
than the received object.
Quote: Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000]
The error could occur in the two cases below.
1. If you use SQL Server version 6.50, and execute the cursor in the job step, set the statement options to use a server-side cursor and prepare a select statement on a SQL Server system table. The first execution of the select creates the cursor successfully.
After you close this cursor, if you execute the prepared statement again, the error could occur.
I recommend you to apply the latest service pack firstly. If the error still occurs, you could change your code by using a forward-only cursor instead of a static, keyset, or dynamic cursor on the system tables. If a forward-only cursor is unacceptable,
prepare the select statement again on the system table and execute it to create a server-side cursor. For more information about the process, please refer to the article:
http://support.microsoft.com/kb/151693/en-us
2. The TDS stream from the server is invalid when transfer data between a database server and a client. This error is typically caused by a problem on the server. For more information about errors above, please refer to the article:
http://technet.microsoft.com/en-us/library/aa937531(v=sql.80).aspx
Regards,
Michelle Li
Similar Messages
-
Log Name: Application
Source: Microsoft-SharePoint Products-SharePoint Foundation
Event ID: 5586
Task Category: Database
Level: Error
Keywords:
User: DOMAIN\SA account
Unknown SQL Exception 0 occurred. Additional error information from SQL Server is included below.
The target principal name is incorrect. Cannot generate SSPI context.
This is the error, if often find in my WFE's. I googled for the error and granted DB owner roles for the service account as specified in TechNet, but no luck.
Even same error logs generated on SharePoint logs.
SqlError: 'The target principal name is incorrect. Cannot generate SSPI context.'
Source: '.Net SqlClient Data Provider' Number: 0 State: 0 Class: 11 Procedure: 'GenClientContext' LineNumber: 0 Server: 'servername\SHAREPOINT,4101'
f2cbcc9c-ac65-7084-fcab-4d2943cdfdea
Unknown SQL Exception 0 occurred. Additional error information from SQL Server is included below.
The target principal name is incorrect. Cannot generate SSPI context.
f2cbcc9c-ac65-7084-fcab-4d2943cdfdea
System.Data.SqlClient.SqlException (0x80131904): The target principal name is incorrect.
Cannot generate SSPI context. at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions
userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnecti...
f2cbcc9c-ac65-7084-fcab-4d2943cdfdea
Thanks.
BadriFor SharePoint to recognize the SQL server name we provide its name and instance while installing SharePoint. When we are using SQL alias to connect to SQL, we need to configure the same alias on SharePoint server so that SharePoint recognize alias over
the network.
Having SharePoint connect to a SQL Alias instead of the NetBIOS name is always a good idea. The main benefit is, if you ever have to switch the SQL Server or connect to a SQL Cluster VIP address, you just change the Alias to point to the SQL Cluster name
on the SharePoint Server and restart the SharePoint Timer Service and you are good to go.
Please check this blog.
http://blogs.msdn.com/b/priyo/archive/2013/09/13/sql-alias-for-sharepoint.aspx
http://technet.microsoft.com/en-us/library/hh292622(v=office.15).aspx
Thank You, Pallav S. Srivastav ----- If this helped you resolve your issue, please mark it Answered. -
SP 2013 Server + Dec 2013 CU. Upgrading from SharePoint 2010.
We have a web application that is distributed over 7-8 content databases from SharePoint 2010. All but one database are upgradable. However, one database gives:
Invalid object name 'Webs'.
while running Test-SPContentDatabase or Mount-SPContentDatabase.
EventViewer has the following reporting 5586 event Id:
Unknown SQL Exception 208 occurred. Additional error information from SQL Server is included below.Invalid object name 'Webs'.
After searching a bit, these links do not help:
http://social.technet.microsoft.com/Forums/sharepoint/en-US/fd020a41-51e6-4a89-9d16-38bff9201241/invalid-object-name-webs?forum=sharepointadmin
we are trying PowerShell only.
http://blog.thefullcircle.com/2013/06/mount-spcontentdatabase-and-test-spcontentdatabase-fail-with-either-invalid-object-name-sites-or-webs/
In our case, these are content databases. This is validated from Central Admin.
http://sharepointjotter.blogspot.com/2012/08/sharepoint-2010-exception-invalid.html
Our's is SharePoint 2013
http://zimmergren.net/technical/findbestcontentdatabaseforsitecreation-problem-after-upgrading-to-sharepoint-2013-solution
Does not seem like the same exact problem.
Any additional input?
Thanks, Soumya | MCITP, SharePoint 2010Hi,
“All but one database are upgradable. However, one database gives:
Invalid object name 'Webs'.”
Did the sentence you mean only one database not upgrade to SharePoint 2013 and given the error?
One or more of the following might be the cause:
Insufficient SQL Server database permissions
SQL Server database is full
Incorrect MDAC version
SQL Server database not found
Incorrect version of SQL Server
SQL Server collation is not supported
Database is read-only
To resolve the issue, you can refer to the following article which contains the causes and resolutions.
http://technet.microsoft.com/en-us/library/ee513056(v=office.14).aspx
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support -
Binding in Prepared Statement is not working with Microsoft SQL Server JDBC
I ran the following program with sqljdbc4.jar in the class path. There is data in the EMPLOYEE table for the employee name DEMO but the following program is not retrieving data for DEMO. When the same program was run with Merlia.jar in the class path, it was retrieving data for DEMO.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:sqlserver://SERVER23:5000;databaseName=TESTDB", "SYSADM", "SYSADM");
String sqlSele = "SELECT * FROM EMPLOYEE WHERE EMPNAME like ?" ;
PreparedStatement sts = con.prepareStatement(sqlSele);
sts.setString(1, "DEMO" );
ResultSet rs = sts.executeQuery();
while(rs.next())
System.out.println("driverConn.main()" + rs.toString());
catch(Exception e)
System.out.println(e);
e.printStackTrace();
Can someone help me out from this issue.This is the program that I used for testing the behaviour of prepared statement with sqljdbc4.jar. Also included the code for Merlia.jar.
import java.sql.*;
public class driverConn {
public static void main(String [] a)
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//Class.forName("com.inet.tds.TdsDriver");
Connection con = DriverManager.getConnection("jdbc:sqlserver://SERVER23:5000;databaseName=TESTDB", "SYSADM", "SYSADM");
//Connection con = DriverManager.getConnection("jdbc:inetdae7a:SERVER23:5000?database=TESTDB", "SYSADM", "SYSADM");
String sqlSele = "SELECT * FROM EMPLOYEE WHERE EMPNAME like ?" ;
//String sqlSele = "SELECT * FROM EMPLOYEE WHERE EMPNAME like ‘%DEMO%’”;
PreparedStatement sts = con.prepareStatement(sqlSele);
sts.setString(1, "DEMO" );
//sts.setString(1, "%DEMO%" );
java.sql.ResultSet rs = sts.executeQuery();
while(rs.next())
System.out.println("EMPNAME is " + rs.getString(“EMPNAME”) + “”); }
catch(Exception e)
System.out.println(e);
e.printStackTrace();
Following are the specifications:
Version of the Driver:
Microsoft JDBC Driver 4.0 for SQL Server CTP3
Downloaded the driver using the link http://www.microsoft.com/download/en/details.aspx?id=11774
Java Version:
Java 1.7.0_02
Database Version:
Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (X64) -
Limitations of Statement.addBatch() jdbc:odbc bridge to SQL Server 2K
Hi all,
I was attempting some performance tuning in my applications and I attempted to use the addBatch method in a statement during a loop and the corresponding executeBatch when the loop is complete. For some reason all my inserts were not sent to the database. So I did a test. I wrote some code that would allow me to create 'X' amount of sql statements and add them to batch and execute. Here's a sample of my code:
void jButton7_actionPerformed(ActionEvent e)
try
if(connect == null)
String url = "jdbc:odbc:someDataSourceName";
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
connect =
DriverManager.getConnection( url, "****", "****");
System.out.println("Connection supports batch updates T/F = " + connect.getMetaData().supportsBatchUpdates());
int x = new Integer(fldNumOfLoops.getText()).intValue();
java.sql.Statement stat = connect.createStatement();
stat.addBatch("create table stutemp (somecolumn varchar(200)); ");
for(int i = 0; i < x; i++)
stat.addBatch("insert into stutemp (somecolumn) values('This is a test of inserting row Number " + i + "'); ");
java.sql.Timestamp tsNow = new java.sql.Timestamp(new java.util.Date().getTime());
stat.executeBatch();
System.out.println("Batching " + x + " rows started " + tsNow + " ended " + new java.sql.Timestamp(new java.util.Date().getTime()));
stat.close();
stat = null;
stat = connect.createStatement();
java.sql.ResultSet rs = stat.executeQuery("select count(*) from stutemp");
while(rs.next())
System.out.println("Results returned from sb batching = " + rs.getString(1));
stat.close();
stat = null;
stat = connect.createStatement();
stat.execute("drop table stutemp");
connect.close();
connect = null;
catch(Exception ex)
ex.printStackTrace();
For some reason, I'm only safe inserting 455 records along with the table create. sometimes it will allow me to insert 456, or 457, but never any more than that. And it fluctuates. Does anyone know why this is? Is there a size limit on adding statements to batch? For giggles, I created a String Buffer version where I'm adding statements to a stringbuffer and doing an execute on the statement. I'm getting the same results.
Thanks,
StuSorry, One more thing. If I put a Thread.Sleep(); after the execute batch I get more inserts depending on the amount of time I tell my thread to sleep.........
What's up with this. Shouldn't this be a Sync process where the calling thread should wait until the statement executes???????????????? -
The SQL statement is not valid - when importing data from SQL Server using a query
Hi there,
I am trying to import data from SQL to Power Pivot using a SQL query like below:
SELECT Score.FieldCount, Score.Record.GetAt(0), Score.Record.GetAt(1), Score.Record.GetAt(2), Score.Record.GetAt(3), Score.Record.GetAt(4)
FROM
SELECT * FROM dbo.CLR1(
dbo.CLR2('c:\FILES\Test.xml'),
'SELECT * FROM [dbo].[CXCustomer_Small]') Input
) Score
And when I tried to validate it, it returns
The SQL statement is not valid. A column name cannot be blank.
I ran the above SQL statement in Management Studio and it works without problem. Any idea?
Thanks!
Chu
-- Predict everything. http://www.predixionsoftware.comNever mind, I figured out - I need to give each column a name.
-- Predict everything. http://www.predixionsoftware.com -
Sending Email Attachment (MSG 22051, Sev 16, State 1)
Date 3/26/2008 1:58:48 PM
Log Job History (WMSIC Missing Product Warehouse)
Step ID 1
Server GKSQLS\GKSQLS
Job Name WMSIC Missing Product Warehouse
Step Name Test for missing 25 records
Duration 00:00:01
Sql Severity 16
Sql Message ID 22051
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Executed as user: GOLDKIST\SQLSvc. Failed to open attachment file '\\GKSQLS\JobsOutput_gksqls\WMSICmissing25.txt'. Executing API 'CreateFile' failed with error number 32. [SQLSTATE 42000] (Error 22051). The step failed.
Can anyone tell me how to determine the security account that's being used by DBMail?? I'm executing a scheduled job owned by SQL Server Agent service account name. Permissions on the shared folder are open to everyone... I execute the code outside of the job and everything works correctly.
Any help is appreciated.Hello,
I just had the same error, and found my mistake.
On the job, I was sending job output in a file, and the last step of the job would send me this file by email.
send_dbmail can't open the file because it's open in exclusive mode by SQL itself to write the email step output...
If you don't save the output of the email step (or save it to another file !) it worked.
P.S. For those people whom the code doesn't work outside of the job, there's another thread about a security problem that brings the same error message.
Hope this helps,
Yves -
Hi!
I'm using ODI 12c to migrate some data from MS Sql server DB to Oracle 12c DB.
I'm using LKM SQL to Oracle and IKM Oracle Update.GLOBAL.
In conversion, i'm using CAST(<smalldatetime field> AS TIMESTAMP).
In step Load Data of LKM SQL to Oracle i'm getting the following error:
8000 : 08006 : java.sql.SQLNonTransientConnectionException: [FMWGEN][SQLServer JDBC Driver]Unhandled token type: Unknown token: 0x45
java.sql.SQLNonTransientConnectionException: [FMWGEN][SQLServer JDBC Driver]Unhandled token type: Unknown token: 0x45
I think it could be caused by the use of LKM SQL to Oracle instead of LKM MSSQL to Oracle. I use SQL to Oracle because I have no agent configured.
Can you help please? Has anyone experienced this error?
Thanks!this appears to be an api management issues, not AAD. Its not appropriate to punt this to the AAD team.
debugging what api management token request on the (AAD) STS sends, in the posted form body, we see
grant_type=authorization_code
code=AAABAAAAvPM1KaPlrEqdFSBzjqfTGKuDarHWcVaE_gAW-T8bBEhryxGinvUkA66Jt-uxbmRl8J5rjUc0aFJi94eDUoO9Bnt-6NR2sXVQYRXhygLUhjdLYrV9UmlBKZu2U_WZFSXO1_6oeIr-1Phz7VoooKJm0Vmh-N4lfUYdPTsbpgbWMhqA60jkFdiGbAwL0ocUrPw-4V8-8PwddLb1mcFOcGERx1jKa62ffZ9L22tJwkAgHhQPvk4K4TDAq60YY1JMWMgUeL9zc3oT_C6AXv6BkiK-cDm6mE9vx3ZTqz6oHP6LdUqE4QO6hukp7ptcr2Tl15WpJus-Ro4hM4gmdXer7hlwBVM22RLdPBKKZOsm649q12SokmOTdhgHcUX0y2aDxqNPhcTwy0z1QNj6pdZ4PiEVJ9i-qxvZrdB2MUSUNrJ7Lw5bEvzD1rM_eSOPjx-rKwu6gSWqYTNFbXcaBgEoQA6m8PULBdItUNwVwjcyeXTHvEhqrYJLBGdhjpucFGTDYqiteM5zyhFj-GiRkS--9x0kv4vg9TbYl0fLFv8bJwjkG19yZIwVKCVelzZ3TVvsQfyT9srcFCCv6BGu2QnLgA-la0Vksu9NnXHh1hpnO1drt7QLXj6p2FTHhCIDEKv1EobQJwFol8yrsTSdi4wJnYa-dvObvFmXn_8nBw57qKFRp-ogAA
redirect_uri=https%3a%2f%2frapmlsqa.portal.azure-api.net%2fdocs%2fservices%2f54e4f45e73c60f106453dac3%2fconsole%2foauth2%2fauthorizationcode%2fcallback
client_id=0bc904ae-3f2c-4ec7-8b71-40f7207112f0
client_secret=fV1OJsfRFOTDdIqTzs%2fdZCRJkHvcPr9fZGJhWo1dQNg%3d
the (Azure) token endpoint receiving this objects to a missing resource parameter, which is admittedly marked as option in the documentation
https://msdn.microsoft.com/en-us/library/azure/dn645542.aspx
it makes perfect sense that in a confidential client flow that the STS would requires nomination of the intended consumer of the token (i.e the api manager endpoint).
This seems to be case where AAD needs two application definitions : one for the requesting all (the developer console) and one for the API manager endpoint itself, whose entity name can be configured so that the subject console app (registration in
AAD) can be granted access to the object endpoint (registration in AAD) with some permission declared in the permission model of the API. -
Oracle statement to SQL Server
Hi All,
I have a oracle statement, I need same logic in SQL Server. I know in SQL server we use CASE statement instead of decode, but I don't understand this oracle statement
Select count(decode(sign((A.StartDate - A.EndDate) - 60) ,-1, 'NewDateField',0, 'NewDateField')) NewDateField_1
From SampleTable A
I need SQL code for this in SQL server.
Thanks in advance,
RH
sqlHi sql9, I am guessing here since DDL is missing.
The code you have shown, calculating difference between startdate and enddate and then deducting 60. The result is checking to see whether negative number or zero ignoring positive number. Finally counting how many of these in a table ie., looks like counting
number of records whose elapsed days between startdate and enddate are less than or equal to 60 days.
Select count(decode(sign((A.StartDate - A.EndDate) - 60) ,-1, 'NewDateField',0, 'NewDateField')) NewDateField_1
From SampleTable A
Few interesting observations:
1. Perhaps startdate and enddate columns are integer data types as there are no date manipulation functions used.
2. It never yields either 0 or positive number unless startdate is greater than enddate.
Please refer the code shown below to prove the above mentioned points. Also note that CNT1, CNT2 and CNT3 are all equivalent to your expected result to pass to aggregate function COUNT. Hope it helps.
declare @SampleTable table ( id int identity,startDate datetime, EndDate datetime, startDT int, EndDt int )
insert into @SampleTable(startDate, EndDate, startDT, EndDt )
values ('04/01/2014', '04/23/2014', 20140401, 20140423),
('01/01/2013', '04/03/2013', 20130101,20130403),
('04/05/2013','04/05/2013', 20130405,20130405),
('04/05/2013','04/05/2014', 20130405,20140405)
select
startdate, enddate,
dateadd(day,60, startdate) 'Add 60 days',
datediff(day, startdate, enddate) 'elapsed days',
case
when dateadd(day, 60,startdate)>= enddate then 1
else null
end as 'cnt1',
case
when startdate>= dateadd(day, -60,enddate) then 1
else null
end as 'cnt2',
case
when datediff(day, startdate, enddate) <=60 then 1
else null
end as 'cnt3',
startDT,
enddt
from @SampleTable
select
count(
case (sign((startDT - enddt)-60))
when -1 then 'NewDateField'
when 0 then 'NewDateField'
end
) as NewDateField_1
from @SampleTable -
i have been trying to create an apple ID for the past 2 days and cannot succeed : it states an unknown error has occurred and no ID is created. What to do?
The internet is the internet. if its not working then its something to do with your not allowing cookies from apple's site or they are having issues.
-
Hello Experts,
Can You help me; I get the follwing error in my query
Msg 1087, Level 15, State 2, Line 31
Must declare the table variable "@ASE_SUBART_GROEP".
the @ASE_SUBART_GROEP is a self-defined table in this SQL environment.
Maybe you know the error or the missing part
Thanks in advance, Jos DielemansI'm not familiar with SAP Business One unfortunately, so can only be of limited help here. But I'm going to guess that @ASE_SUBART_GROEP is a table variable passed to a stored procedure and is defined and passed down by the application, so you won't
be able to copy-paste this code directly into management studio and get it to work.
You could remove the join to return *all* records. Although the dataset might be very big
SELECT T0.CardCode AS 'Klantnr'
,T0.CardName AS 'Klantnaam'
,T4.GroupName AS 'Klantgroep'
,T9.Descr AS 'Merknaam'
,T5.SlpName AS 'Verkoper'
,T3.MailCity AS 'Leverplaats'
,T7.NAME AS 'Leverland'
,T3.City AS 'Factuurplaats'
,T7.NAME AS 'Factuurland'
,T0.DocNum AS 'Documentnr'
,T0.DocDate AS 'Datum'
,Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) AS 'Jaar'
,RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2) AS 'Maand'
,(Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) + '-' + RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2)) AS 'Periode'
,T1.ItemCode AS 'Artikelnr'
,T2.ItemName AS 'Artikelnaam'
,T1.Quantity AS 'Aantal VEH'
,T2.SVolume AS 'Aantal EH per VEH'
,(T1.Quantity * T2.SVolume) AS 'Aantal EH'
,T8.UnitName AS 'EH-Naam'
,T6.ItmsGrpNam AS 'Artikelgroep'
,T2.U_ItemGrp AS 'Hoofdgroep'
,T10.NAME AS 'Subgroep'
,T1.CogsAcct AS 'Kostpr.rek.'
,T1.AcctCode AS 'Opbrengstrek.'
,T1.LineTotal AS 'BrutoOmzet'
,T0.DiscPrcnt AS 'Korting'
,(+ T1.LineTotal * (100 - T0.DiscPrcnt) / 100) AS 'NettoOmzet'
FROM dbo.OINV T0
INNER JOIN dbo.INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
INNER JOIN OCRG T4 ON T3.GroupCode = T4.Groupcode
INNER JOIN OSLP T5 ON T3.SlpCode = T5.SlpCode
INNER JOIN OITB T6 ON T2.ItmsGrpCod = T6.ItmsGrpCod
INNER JOIN OCRY T7 ON T3.Country = T7.Code
LEFT OUTER JOIN OLGT T8 ON T2.SVolUnit = T8.UnitCode
LEFT OUTER JOIN UFD1 T9 ON T3.U_ZPgroep = T9.FldValue
AND TableID = 'OCRD'
AND FieldID = 2
--LEFT OUTER JOIN @ASE_SUBART_GROEP T10 ON T2.U_ASE_SUB_ARTGROEP = T10.Code
WHERE T0.DocDate >= '20120101'
AND T0.Canceled = 'N'
UNION ALL
SELECT T0.CardCode AS 'Klantnr'
,T0.CardName AS 'Klantnaam'
,T4.GroupName AS 'Klantgroep'
,T9.Descr AS 'Merknaam'
,T5.SlpName AS 'Verkoper'
,T3.MailCity AS 'Leverplaats'
,T7.NAME AS 'Leverland'
,T3.City AS 'Factuurplaats'
,T7.NAME AS 'Factuurland'
,T0.DocNum AS 'Documentnr'
,T0.DocDate AS 'Datum'
,Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) AS 'Jaar'
,RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2) AS 'Maand'
,(Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) + '-' + RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2)) AS 'Periode'
,T1.ItemCode AS 'Artikelnr'
,T2.ItemName AS 'Artikelnaam'
,- T1.Quantity AS 'Aantal VEH'
,T2.SVolume AS 'Aantal EH per VEH'
,(- T1.Quantity * T2.SVolume) AS 'aantal EH'
,T8.UnitName AS 'EH-Naam'
,T6.ItmsGrpNam AS 'Artikelgroep'
,T2.U_ItemGrp AS 'Hoofdgroep'
,T10.NAME AS 'Subgroep'
,T1.CogsAcct AS 'Kostpr.rek.'
,T1.AcctCode AS 'Opbrengstrek.'
,- T1.LineTotal AS 'BrutoOmzet'
,T0.DiscPrcnt AS 'Korting'
,(+ T1.LineTotal * (100 - T0.DiscPrcnt) / 100) AS 'NettoOmzet'
FROM dbo.ORIN T0
INNER JOIN dbo.RIN1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
INNER JOIN OCRG T4 ON T3.GroupCode = T4.Groupcode
INNER JOIN OSLP T5 ON T3.SlpCode = T5.SlpCode
INNER JOIN OITB T6 ON T2.ItmsGrpCod = T6.ItmsGrpCod
INNER JOIN OCRY T7 ON T3.Country = T7.Code
LEFT OUTER JOIN OLGT T8 ON T2.SVolUnit = T8.UnitCode
LEFT OUTER JOIN UFD1 T9 ON T3.U_ZPgroep = T9.FldValue
AND TableID = 'OCRD'
AND FieldID = 2
--LEFT OUTER JOIN @ASE_SUBART_GROEP T10 ON T2.U_ASE_SUB_ARTGROEP = T10.Code
WHERE T0.DocDate >= '20120101'
AND T0.Canceled = 'N'
ORDER BY T0.CardCode
The join to the table variable has been commented out above, so the code should run. After that you might want to update the WHERE clause to include only particular sub-groups -
Location: bcpimp.cpp:1797
Expression: cbOutTemp < cbOutputStr
SPID: 52
Process ID: 2364
Msg 3624, Level 20, State 1, Line 3
A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to
Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a QFE from Technical Support.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.If you check your sql server error log folder you will see dump files created. You need to send those dump files to Microsoft for inspection because outside of microsoft product support the symbols for reading the dumps are not available without which it
wont be easy to find the issue.
http://support.microsoft.com/kb/2028589
In the meantime check if you are on the latest version of Service Pack and if not apply the latest service pack. Majority of these kind of assertions are bugs which are solved in Service Packs/Cumulative Updates.
Regards, Ashwin Menon My Blog - http:\\sqllearnings.com -
Hello,
Can anyone help me?
select year(po.rdata) as 'Ano',
sum(etotal) as 'Valorp' ,
(select year(fo.data),Sum(etotal)
FROM fo (nolock)
where not exists ( select 1 from pl (nolock) where pl.adoc = fo.adoc and pl.cm = fo.doccode )
group by year(fo.data))as 'Valorap'
from po
group by year(po.rdata)
order by year(po.rdata)
Error
Msg 116, Level 16, State 1, Line 6
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
ConsultoraHi Prashanth,
select year(po.rdata) as 'Ano',
sum(etotal) as 'Valorp' ,
(select Sum(etotal)
FROM fo (nolock)
where not exists ( select 1 from pl (nolock) where pl.adoc = fo.adoc and pl.cm = fo.doccode )
group by year(fo.data))as 'Valorap'
from po(nolock)
group by year(po.rdata)
order by year(po.rdata)
Gives me the error:
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Thanks
Consultora -
I get msg iPad cannot be synced. an unknown error occurred. (-50).
I get msg iPad cannot be synced. an unknown error occurred. (-50).
I have same problem. Anyone help on this???
-
Linked Server error - Msg 7311, Level 16, State 2
We have three SQL Servers:
SQL 2008 Instance w/ SP1 cumulative update #5; running on Windows Server 2008 r2
SQL 2008 Instance w/ SP1 cumulative update #5; running on Windows Server 2003 r2
SQL 2000 Instance w/ SP4; running on Windows Server 2003 r2 W/ SP2
We have a linked server connection from #2 to #3, which works perfectly. However, our linked server connection from #1 to #3 does not work. here is the error message we get:
OLE DB provider "SQLNCLI10" for linked server "CCSSQLTEST01A" returned message "Unspecified error".
OLE DB provider "SQLNCLI10" for linked server "CCSSQLTEST01A" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI10" for linked server "CCSSQLTEST01A". The provider supports the interface, but returns a failure code when it is used.
I've read articles saying we may need to run a specific script on the server we are linking to, due to missing SPs, but how can that be possible if the other linked server connection works? We are linking from two identical
SQL Server instances (other than the OS)...
The only other difference I know of, is that #1 was an upgrade from SQL 2005, but #2 was a clean install of SQL 2008.
Suggestions?
ClintI really don't think this is the case otherwise in my .Net applications I'd have to determine the version of the target SQL server, then instantiate the appropriate connection object. Things just don't work that way. I'm pretty sure
you will find that a SQL Native Client 10 provider can connect to anything from SQL 2008 and below, but not anything above (once it is released :).
The real issue is given in the message. Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO"
If
you source server is 64 bit and your target is 32 bit then you will need to do the following. (I have to pass credit to Kun Sik Lee of Costar Group for this one)
create
procedure sp_tables_info_rowset_64
@table_name
sysname,
@table_schema
sysname =
null,
@table_type
nvarchar(255)
= null
as
declare @Result
int set @Result
= 0
exec @Result
= sp_tables_info_rowset
@table_name, @table_schema, @table_type
GO
use [master]
GO
GRANT
EXECUTE ON [dbo].[sp_tables_info_rowset_64]
TO [LinkServerUser]
GO
Maybe you are looking for
-
Output Message Type MAHN not getting picked up in PO
Hello Experts I have configured customized output type ZMAH (similar to MAHN) for reminder process. When I am creating PO this output type is not getting picked up automatically. If I am maintaining it manually I am able to send message for ME9F (
-
I uploaded photos from my iphoto, and deleted the originals. Then my iphoto unexpectedly quit. Is there any way to recover these photos?
-
With Java8, how can I make my tooltips behave as they did with Java7?
Since some of my customers may want to run Java8, I decided to try my application with Java8. There were quite a few problems most of which were resolved when I decided to do a revamp in anticipation having to have the system run on Android and ios p
-
Ibooks in waiting mode for two days when trying to update?
I have attamepted to update ibooks, however it has been in waiting mode for two days now and won't complete...???
-
Applying transitions in the timeline
Hi, I have recently created a dvd of videos and stills but when viewed on a tv the stills are pixelated. I originally created the sequences in premiere and rendered them out as mp4, to use in encore. However, when the the movie is played the still im