Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 26, 2011 05:32 AM by ankush_kulkarnise
Apr 16, 2011 09:02 AM|LINK
i am trying to get the row nos. as [ DuplicateNo ] column in select query.
string oledbQueryStr =
"SELECT " + PKTOAPPEND +
" AS [UploadModelCSVID]," + CRBYTOAPPEND +
" AS [CrById],ROW_NUMBER() OVER ( ORDER BY MachineryName ) AS DuplicateNo,"
+ "* FROM [Sheet1$];";
this i was successfully doing--
string oledbQueryStr = "SELECT " + PKTOAPPEND + " AS [UploadModelCSVID]," + CRBYTOAPPEND + " AS [CrById]," + "* FROM [Sheet1$];";
in 1st query if i insert breakpoint and execute in Sql server by replacing [Sheet1] by my table name then it works perfectly.
anyone tell me what to do in oledb commands to insert row numbers????
is there any need of cursor or some??
1st query results in the exception--
error (missing operator) in query expression 'ROW_NUMBER() OVER ( ORDER BY MachineryName )'.
Apr 16, 2011 08:36 PM|LINK
DuplicateNo," + "FROM
DuplicateNo" + "FROM
there should be no comma before a FROM statement.
Apr 18, 2011 07:55 AM|LINK
It is DuplicateNo," + " * FROM
* is there between DuplicateNo and FROM.
Apr 18, 2011 08:49 AM|LINK
the 1st query results in the exception--
Apr 18, 2011 08:09 PM|LINK
It is harder to read this new smaller font that appeare in the recent forum upgrade.
Do we even know if Excel OLEDB supports the ROW_NUMBER() function at all???
Apr 19, 2011 06:44 AM|LINK
thats what i need to know..
ROW_NUMBER() must be having different syntax in oledb command altogether I searched through internet but no use.
Also REPLACE() doesnt work under oledb.
Apr 19, 2011 08:16 AM|LINK
you can get row number using query in following way
select ID, Name, ROW_Number() over(order by ID) as 'RowNum' from User
here this query will help you to get row number from your table.
Apr 19, 2011 12:33 PM|LINK
but whether it would work under oledb command??
Apr 19, 2011 09:39 PM|LINK
I have two big books on Excel and cross searched OLEDB documentation and I found as well no references that the MSSQL ROW_NUMBER function is supported in Excel OLEDB.
Apr 20, 2011 05:30 AM|LINK
i also found no reference to it on net.