Using 11.0 SP2 sql server manager.
I am trying to extract the values from the xml but I keep receiving the error 2205 "XQuery was expected". I do not understand why I am receiving that error since the XML is coming from a sql table. It is my understanding that the XQuery is needed to specify a path but if the data is already in the sql table referenced then why is a specific path needed?
Select
XmlData.value('(/ItemInformation Culture/title)[1]','varchar(max)') as Title
From
[ArcDev].[dbo].[XmlRetrieval2]
Msg 2205, Level 16, State 1, Line 3 XQuery
[ArcDev.dbo.XmlRetrieval2.XmlData.value()]: ")" was expected.
The table looks like this:
XmlRetrieval2
You picture does not show the structure of your XML, if this does not solve your problem you should paste a (reduced) example of your XML.
From the picture I take that there is one element "ESRI_ItemInformation" with an attribute "Culture". It might be "ESRI" and "ItemInformation_Culture", but I don't think so...
If "title" is an element one level below the "ESRI_ItemInformation" your query might be this:
Select
XmlData.value('(/ESRI_ItemInformation/title)[1]','varchar(max)') as Title
From
[ArcDev].[dbo].[XmlRetrieval2]
Related
I have connected CSV file as database in automation anywhere tool and i want to update certain column values using update query.
Update [$vOutputFileName$]
Set [column 7] = 88
Where [column1] = "5744543"
When I use this query, I get an error
[Microsoft][ODBC Text Driver] Too few parameters. Expected 1.
Please help.
Try ' instead of "
This is from MS Reference.
Other incorrect formatting like extra spaces in the SQL statement can also cause this error.
select xmlquery('$MESSAGE/Order/#OrderNo') from yfs_reprocess_error ;
DB2 query for fetching order number attribute from xml (stored in Message column).
While i'm trying to Fetch XML data from the database in DB2 using the below query. Getting error
The result of an intermediate step expression in an XQuery path expression contains an atomic value.
Error QName=err:XPTY0019..
Let me guess your XML structure.
Use the following as an example.
select xmlcast(xmlquery('$MESSAGE/Order/#OrderNo' passing MSG as "MESSAGE") as int)
from (values xmlparse(document '<Order OrderNo="1"/>')) yfs_reprocess_error(MSG);
If your XML document has another structure, then please, provide its example.
Through SAS/ACCESS, I can successfully run data steps querying external DBMS tables. E.g.,
Data OutTable;
Set ExternalDBMS.Table1;
Where Var1 ='abc';
Run;
However, when column name has space, it caused a problem even I used ''n.
One example as shown below:
Data OutTable;
Set ExternalDBMS.Table1;
Where 'Var 2'n ='abc';
Run;
ERROR: CLI open cursor error: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Incorrect syntax near the keyword 'Function'.
Further try with SAS Option validvarname=v7 to standardize the var names with spaces still caused same error.
After using SAS Option sastrace=',,,d' I found that SAS/ACCESS submitted statement to SQL server like this:
SELECT Var 1, .....
FROM schema1.Table1
WHERE (Var 1 ='abc' );
Apparently the code above would cause error in SQL server side because the Var 1 was neither quoted nor bracketed.
One way to fix it is using explicit pass-through query. I'm just wondering if there's any other ways to solve this problem too.
Thanks in advance!
when using an explicit pass-through query, put a set of square brackets around the variable name. This would be similar to how you'd write your code in SSMS.
SELECT [Var 1], ...
FROM schema1.Table1
WHERE ([Var 1] ='abc' );
My RDMS is the above. I have a stored procedure that takes 13 parameters. I have a table that holds those input values. I am pasting what I have done. Please help because its not executing. I am getting the following error: Incorrect syntax near '.'.
Please look at the attachment to see the location of the table I am trying to use.enter image description here
use ssisconfiguration.dbo.BalladHealthDayOneStats;
exec Clarity.ssis.sp_BalladDayOneMaster
[StatisticStartDate],[StatisticEndDate],[CostCenterList],[ProcedureCodeList],[Statistic],[StatisticDescription],[PatientTypeIndicator],
--[RVThreshold],[FiscalYear],
1,2017,
[PatientServiceList],[PatientClassList],[PatientStatusList]
The purpose of USE is to select the database.
i would suggest modify to
use ssisconfiguration
exec Clarity.ssis.sp_BalladDayOneMaster
([StatisticStartDate],[StatisticEndDate],[CostCenterList],[ProcedureCodeList],[Statistic],[StatisticDescription],[PatientTypeIndicator],
--[RVThreshold],[FiscalYear],
1,2017,
[PatientServiceList],[PatientClassList],[PatientStatusList])
replace the column name with values in the []
There seems to have been many discussions on this but I couldn't find something specific to what I am looking for. I am trying to use a query to import data from Excel to an existing table in SQL Server.
My query is:
INSERT INTO DailyRawData
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml; HDR=NO;
Database=C:\Users\home\Desktop\SQLImportTrim.xls', [data$]);
I get the following error:
Msg 7314, Level 16, State 1, Line 2
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" does not contain the table "data$". The table either does not exist or the current user does not have permissions on that table.
I don't think this is a permission issue for me as I am set up as SysAdmn. I am wondering if the error is due to the last part of the query [data$] since this is what the error msg refers to. FYI the name of the excel file is SQLImportTrim and the tab that contains all my data is named data. There is no table named data in my Excel file. Is my query correct?
you don't use [data$] you use the name of the sheet, so the standard starting point is usually [Sheet1$] if you haven't renamed it.