NevJam (1/14/2009)
Great thanks that works now - I'm having trouble getting sqlcmd to work correctly so I've started looking at BCP.exeI've managed to rewrite your script so that my wmi results are output to a .xls file
Does anyone know the BCP command to get a local xls file loaded into a remote sql table?
I can manage to get the command working if I copy the data out of the .xls and into a .txt:
db = TEST
table = LogMemory
server = lonwintel01
This bcp command works for .txt file - does anyone know the correct switches for a .xls file:
bcp TEST..LogMemory in "c:\ps\scripts\import.txt" -S lonwintel01 -T
BCP does not work with Excel files. Keep in mind the T-SQL shown in the article for sqlcmd could have been executed with Query Analyzer, SSMS or osql instead of sqlcmd
BULK INSERT dbautility.dbo.DiskUsage FROM 'C:\Users\u00\bin\diskusage.csv'
WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = ''
You can use DTS or SSIS with Excel files.