on 10-08-2014 5:56 AM
Hello,
I want to run a SQLCMD...
I have the following query I run in SAP B1:
SELECT T0.[CardCode], T0.[Address], T0.[LineNum]
FROM CRD1 T0
JOIN OCRD T1 ON T1.CardCode=T0.CardCode
WHERE T0.[AdresType] ='S' and T0.Address != T1.ShipToDef AND T1.CardCode LIKE '[%0]%'
Here is what I have:
SQLCMD -S <servername> -d <db_name> -U <username> -P <password> -Q "set nocount on;SELECT T0.CardCode, T0.LineNum, T0.Address, T0.Block, T0.Street, T0.City, T0.County, T0.State, T0.ZipCode FROM CRD1 T0 JOIN OCRD T1 ON T1.CardCode=T0.CardCode and T0.[AdresType] ='S' and T0.Address != T1.ShipToDef" -s "," -o "\\network\testing.txt" -h-1 -s"~" -W -w 999
This appears to work - but I just wanted to make sure, can someone please comment on whether this is giving me a export file with all ship-to addresses which aren't the default address?
Regards
Rick
Hi Richard
Its not advice to use the SQLCMD at the database level, As SAP best practices to fetch the data you have to use either SAP ABAP coding or BI Query’s.
Regards
SS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi SS,
The reason I am using SQLCMD is that I needed to automate a query to export to TXT or CSV file. This was the first method I came across that allowed me to do that.
Is there some major reason why I shouldn't be doing what I'm doing at a database level?
Happy to be told otherwise as long as you can indicate how I go about this.
Regards
Rick
Hi Richard
You can create a custom code program to export the spool output to CSV file format. and also you can refer the SAP link Exporting as a CSV File/Excel File - Business Intelligence - SAP Library
BR
SS
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.