Click here to Skip to main content
12,450,335 members (45,241 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL Server
Here is the sql statement:
INSERT INTO BinarizeResults(url, [file],[state],Binarize,Binarize2,FilterGaussian,FilterMedianSmooth,HoughLines,OptimizeImageSize,PreprocessImage,RemovePepperNoise,RemoveSaltNoise,accuracy,Task_Length)
SELECT X.a.query('url'.value('.','VARCHAR(50)')),
       X.a.query('file'.value('.','VARCHAR(50)')),
	   X.a.query('state'.value('.','VARCHAR(20)')),
	   X.a.query('Binarize'.value('.','VARCHAR(6)')),
	   X.a.query('Binarize2'.value('.','VARCHAR(6)')),
	   X.a.query('FilterGaussian'.value('.','VARCHAR(6)')),
	   X.a.query('FilterMedianSmooth'.value('.','VARCHAR(6)')),
	   X.a.query('HoughLines'.value('.','VARCHAR(6)')),
	   X.a.query('OptimizeImageSize'.value('.','VARCHAR(6)')),
	   X.a.query('PreprocessImage'.value('.','VARCHAR(6)')),
	   X.a.query('RemovePepperNoise'.value('.','VARCHAR(6)')),
	   X.a.query('RemoveSaltNoise'.value('.','VARCHAR(6)')),
	   X.a.query('accuracy'.value('.','VARCHAR(6)')),
	   X.a.query('Task_Length'.value('.','VARCHAR(10)'))
FROM (
	  SELECT CAST(x AS XML)
      FROM OPENROWSET(
					  BULK 'C:\Users\Jarmendariz\Desktop\ocrbinarize.xml', SINGLE_BLOB
					  ) 
	  AS T(x)
	  )
AS T(x)
CROSS APPLY x.nodes('resultset/results/result') AS X(a);
Posted 21-Aug-14 2:45am
Updated 21-Aug-14 3:06am
v3

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

It looks like you've got your parentheses in the wrong place. Instead of:
X.a.query('url'.value('.','VARCHAR(50)'))
try:
X.a.query('url').value('.','VARCHAR(50)')
  Permalink  
Comments
digimanus 21-Aug-14 10:40am
   
sharp!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 21 Aug 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100