-
Problems extracting data from tables with osql.
Hi @ll, I'm trying to extract data from a database where columns have names with spaces inside, I show an example:
select "total amount"
from sales;
This query shows me all data stored in the "total amount" column in table sales, ok no problem.
Well, the problem comes when I try to execute this query with osql because the output text file where I put the data only have the text "total amount".
I use the query as I wrote before stored in a text file.
I'm doing something like this:
osql -U user -P passwd -i query.sql -o textfile.txt
Can anybody give a hand? What I'm doing wrong?
Thank you in advance.
Bye.
-
To use "" for column names you have to turn SET QUOTED_IDENTIFIER ON, instead of "" you can use [] as
select [total amount]
from sales;
-
Thanks a lot skhanal, I'm newbie in Sql Server and I didn't know this detail.
I have tested it and works perfefctly.
Bye.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|