Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
catontheroof
Starting Member
3 Posts |
Posted - 2009-08-06 : 05:05:29
|
| Hello all, I am new to MS SQL ServerI want to export the record in 1 table into text file in the database using isql syntax. Why the records from SQL Analyzer was different with my script using iSQL (which will create a file)? From SQL Analyzer, I will get the records what I want but I will found 0 record on the file through iSQL. When I tried to remove the date inside ExportCurrencyStmt.sql and it will return the correct records. Anybody know the solution? Thanks in advancedInside ExportCurrency.batisql -d [dbname] -U -P -q -n -w 10000 -i c:\ExportCurrencyStmt.sql -o c:\Currency.txtInside ExportCurrencyStmt.sql:SET NOCOUNT ONSELECT CONVERT(varchar(8), Crtd_DateTime, 112) Crtd_DateTime,CONVERT(varchar(8), EffDate, 112) EffDate,FromCuryId,MultDiv,Rate,RateReciprocal,RateType, ToCuryIdFROM curyrateWHERE ToCuryId = 'IDR'AND FromCuryId = 'USD'AND RateType = 'BIMID'AND MultDiv = 'M'AND Crtd_DateTime BETWEEN (GETDATE() - 30) AND GETDATE() |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-06 : 05:09:07
|
Where is your option for server name, "-s" ? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
catontheroof
Starting Member
3 Posts |
Posted - 2009-08-06 : 05:27:30
|
quote: Originally posted by Peso Where is your option for server name, "-s" ? N 56°04'39.26"E 12°55'05.63"
Previously, I didn't use -s option. But I tried to use it and it will add separator between its fields. I am looking at the isql /? and found -s is for separator. Did you mean -S (upper case)?What if I don't know the server name can I use IP Address? Because in Enterprise Manager, I only see the IP. Sorry, I am new with MSSQLThanks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-06 : 05:29:04
|
Use an UPPER "S" since isql options are Case Sensitive.See Microsoft KB here. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
catontheroof
Starting Member
3 Posts |
Posted - 2009-08-06 : 06:10:22
|
quote: Originally posted by Peso Use an UPPER "S" since isql options are Case Sensitive.See Microsoft KB here. N 56°04'39.26"E 12°55'05.63"
Hello,I've solved the problems. The problem was when I import the data from excel using Import and Export Data tool. The table which I made replaced by new one, and the datatype changed from datetime to varchar.Thanks Peso for your help |
 |
|
|
|
|
|
|
|