question

ngreene1980 avatar image
ngreene1980 asked

Add " " to Outer Join

At the bottom is my whole query, that'm running from command line to export to csv for an import to a web site e-store. I want to encapsulate the NOTES.NTS_NOTE values "text" in " " for the csv import. The code lines that are relevant I think. NOTES.NTS_NOTE FROM ITEMS LEFT OUTER JOIN NOTES ON NOTES.NTS_N_ID=ITEMS.ITE_INVNO AND NOTES.NTS_TYPE='X' So that LEFT OUTER JOIN needs to be in " ". SELECT ITEMS.ITE_INVNO , QUOTENAME(ITEMS.ITE_LONGDESC, '"'), ITEMS.ITE_BARCODE , ITEMS.ITE_DeptName , ITEMS.ITE_CATG , ITEMS.ITE_Weight , ITPRICE.ITP_PRICE1 , ITPRICE.ITP_PRICE2 , Pivot_Results.SHORT , Pivot_Results.SIZE , Pivot_Results.COLOR , ***NOTES.NTS_NOTE*** FROM ITEMS INNER JOIN ITPRICE ON ITEMS.ITE_INVNO = ITPRICE.ITP_INVNO LEFT OUTER JOIN NOTES ON NOTES.NTS_N_ID=ITEMS.ITE_INVNO AND NOTES.NTS_TYPE='X' LEFT JOIN ( SELECT UDF_INVNO , SHORT , SIZE , COLOR FROM ( SELECT UDF_INVNO , UDF_UDFLD1 , UDF_UDDES1 FROM UDFIELDS ) AS Pre_Pivot PIVOT( MAX(UDF_UDFLD1) FOR UDF_UDDES1 IN ( [SHORT], [SIZE], [COLOR] ) ) AS pvt ) AS Pivot_Results ON ITEMS.ITE_INVNO = Pivot_Results.UDF_INVNO; Thanks in advance. If it's easier to just make the sqlcmd export all values in " ", I'm ok doing that as well. sqlcmd -s .\sqlexpress -d POS5231987 -E -s, -W -i inventoryv7.sql > inventory.csv
joins
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.