rhishi20 Posted July 2, 2015 Share Posted July 2, 2015 Dear Friends , I am just going through SQL Stored Procedure which is previously created. it contains mail Generation in HTML through SQL. in following code i am not able to understand use of number (1) & (2) please explain me. ----------------------------------------------------------------------------------------------------------------------SET @tableHTML = N'<H>MRP Indent Details</H>' + N'<table border="1">' + N'<tr><th>Indent Code</th><th>Indent Date</th><th>indent Type</th>' + N'<th>Approved BY</th><th>Cost center</th><th>No Of Items</th><th>Approximate Rate</th></tr>'+ CAST ((select td=a.Indentcd,' ', (1) ' ' td=a.IndentDt,'', td=a.indenttype,' ', td=a.ApprovedBy,' ', td=a.ccncd,' ', "td/@align" = 'right',td=a.Itemcnt,' ', "td/@align" = 'right',td=a.mthwtavgrate,' ' from TmpMRPMail a FOR XML PATH('tr'), TYPE ) AS NVARCHAR(MAX)) + N'</table>' ; (2) XML Path ----------------------------------------------------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
justsomeguy Posted July 2, 2015 Share Posted July 2, 2015 Both of those lines are part of the same cast statement, is cast what you don't understand? Link to comment Share on other sites More sharing options...
rhishi20 Posted July 3, 2015 Author Share Posted July 3, 2015 I am not understanding why there are quotes ' ' after column name and function of xml path. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 6, 2015 Share Posted July 6, 2015 I'm not sure, but maybe they are selecting blank values or spaces to match a certain column structure or something similar. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now