Showing posts with label copied. Show all posts
Showing posts with label copied. Show all posts

Thursday, March 29, 2012

FTP Task in a SQL Server Agent Scheduled Job - Corrupts Excel file?

We are not certain if this has happened due to the SSIS FTP Task, but incidently the Excel file that is being copied from the FTP site using an SSIS FTP Task got corrupted a couple hours after the package was scheduled as a SQL Server Agent Job on SQL Server 2005.

I had a SQL Server 2000 DTS package doing the same thing, but it was never an issue then. I was using the FTP Task there along with an Excel Data source in that and has been working for a couple years atleast with never any corruption related issues.

In the SSIS SQL Server 2005 package I am using an FTP Task with an Excel Connection Manager and Excel source and the Excel file got corrupted within a couple hours of the package being scheduled as a SQL Server Agent job.

Has anyone experienced this issue? Any inputs will be appreciated.

Just as an fyi, the excel file has a lot of vlookups.

Thanks,

MShah

The FTP task does not delete existing file when downloading new one with the same name (we have recently found it and planning to fix for SP2). So if the downloaded file is smaller than existing one, it overwrites the beginning of existing file with new content, but the remaining file content might be from previous file.

The workaround is to use File System Task to delete existing file before downloading new one.

Friday, March 9, 2012

French characters are not imported properly with bcp

Hi
I have a script that uses bcp to import data from an ascii text file
into SQL tables. The french characters are not copied properly. They
are converted to letters of the alphabet. I tried to change all the
fields to nvarchar instead of varchar and nchar instead of char, but I
got Greek characters instead.

How can I fix this?

Here is some code:
--------
CREATE TABLE [dbo].[1_HLGT_HLT_COMP_f9.0] (
[hlgt_code] [int] NOT NULL ,
[hlt_code] [int] NOT NULL
) ON [PRIMARY]
GO

PRINT 'HLGT_HLT'
DECLARE @.s as nvarchar(300)
SET @.s='bcp MedDRA..[1_hlgt_hlt_comp_f9.0] in ' + char(34) +
'F:\MedDRA\9.0French\MedAscii\hlgt_hlt.asc' + char(34) + ' -c -t' +
char(34) + '$' + char(34) + ' -r$\n -e' + char(34) +
'F:\MedDRA\9.0French\logs\hlgt_hlt.err.txt' + char(34) + ' -b250 -m50
-SDEV -Usa -Ppassword -h' + char(34) + 'TABLOCK' + char(34)
EXEC master..xp_cmdshell @.sWael (sedky@.rocketmail.com) writes:
> I have a script that uses bcp to import data from an ascii text file
> into SQL tables. The french characters are not copied properly. They
> are converted to letters of the alphabet. I tried to change all the
> fields to nvarchar instead of varchar and nchar instead of char, but I
> got Greek characters instead.

Add -C RAW to the list of BCP options. By default, BCP assumes that
characters are in the OEM code page and will convert them to the ANSI
code page. Which results in a mess when data is already in the ANSI
code page.

> How can I fix this?
> Here is some code:
> --------
> CREATE TABLE [dbo].[1_HLGT_HLT_COMP_f9.0] (
> [hlgt_code] [int] NOT NULL ,
> [hlt_code] [int] NOT NULL
> ) ON [PRIMARY]
> GO

Eh, there are character columns in that table?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Does this require any special install on the server? I tried -C863 for
Canadian French, but the server does not recognize that code page.|||Wael (sedky@.rocketmail.com) writes:
> Does this require any special install on the server? I tried -C863 for
> Canadian French, but the server does not recognize that code page.

I have not heard of 863 before, but it sounds like an OEM code page.

Playing around a little, it appears that you can only use code pages
for which there are one or more collations. For instace, I tried CP852
which is Eastern Europe, but this gave me an error. On the the other
hand, 874 worked. (There are a number of Thai collations with that code
page.)

But is your file really in code page 863? And in such case how different
would it be from code page 850? (My standard source for checking out
code pages is down, so I can't check right now.)

Did you try -C RAW?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||I tried -C RAW but i got an error. If you check the windows regional
settings, you'll see 863 is the code page for Canadian French.

Regional and Language Options\Advanced|||Wael (sedky@.rocketmail.com) writes:
> I tried -C RAW but i got an error.

An error? Care to specify what? It's difficult to assist without knowing
the error message.

> If you check the windows regional
> settings, you'll see 863 is the code page for Canadian French.
> Regional and Language Options\Advanced

Yes, I also see that it is an OEM code page. Is the data file in this
code page?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||For question number 1, the error is pasted below.
For the second one I am not sure. The original text is a plain text
file.

NULL
Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Code page 863 is
not supported by SQL Server
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Unable to resolve column
level collations
NULL
BCP copy in failed
NULL

(9 row(s) affected)|||Wael (sedky@.rocketmail.com) writes:
> For question number 1, the error is pasted below.
> For the second one I am not sure. The original text is a plain text
> file.

If you the open file in Notepad, does it look good then? If it does,
it is not an OEM file. If the French characters are replaced with
other single characters, it could be CP863.

If the file looks bad in Notepad, does it look good when you type it
from a command-line window.

I'm a little surprised of the message you got with -C RAW. I was under
the impression that this would suppress all code-page conversion.

Anyway, if the file looks good in Notepad, use -C ACP or -C 1252.

If it looks goot in the command-line window, try -C 850. I don't know
about CP 863, but I would expected to be a version of CP 850.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||It worked. ACP worked.

THank you very much.

Sunday, February 26, 2012

Free Text Search

We have two SQL Server 2000 servers with SP4 loaded. We have copied a
database from one to the other. The free text search runs on the original
server and produces results but on the new server it runs but produces a nil
return.
Can anyone offer any help?
Confused but battling on
"Madame Artois" <MadameArtois@.discussions.microsoft.com> wrote in message
news:C3B84E7A-4085-4089-85B8-820174CC303E@.microsoft.com...
> We have two SQL Server 2000 servers with SP4 loaded. We have copied a
> database from one to the other. The free text search runs on the original
> server and produces results but on the new server it runs but produces a
> nil
> return.
Free text?
I assume you mean FULL TEXT?
Did you copy the Full-text indices to the same place?
Did you enable full-text on the new database?
How was the data moved?

> Can anyone offer any help?
> --
> Confused but battling on
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
|||Sorry I did mean full text search. We have tried to re create the indices
and the search but it still returns a nil result. The full text search
service is running.
How do you enable full text search on a database?
The database was moved by backing up to a device, then copying the device to
the new location and restoring it (changing the file locations etc).
Eeverything else in the database works fine; it is just this full text search
Confused but battling on
"Greg D. Moore (Strider)" wrote:

> "Madame Artois" <MadameArtois@.discussions.microsoft.com> wrote in message
> news:C3B84E7A-4085-4089-85B8-820174CC303E@.microsoft.com...
> Sorry I did mean Full Text Search.
The full text searches had been copied to the same place and I'm not sure
what you mean about enabling full test searches on the database.
The full text search service is running
> Free text?
> I assume you mean FULL TEXT?
> Did you copy the Full-text indices to the same place?
> Did you enable full-text on the new database?
> How was the data moved?
>
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
>
>

Free Text Search

We have two SQL Server 2000 servers with SP4 loaded. We have copied a
database from one to the other. The free text search runs on the original
server and produces results but on the new server it runs but produces a nil
return.
Can anyone offer any help?
--
Confused but battling on"Madame Artois" <MadameArtois@.discussions.microsoft.com> wrote in message
news:C3B84E7A-4085-4089-85B8-820174CC303E@.microsoft.com...
> We have two SQL Server 2000 servers with SP4 loaded. We have copied a
> database from one to the other. The free text search runs on the original
> server and produces results but on the new server it runs but produces a
> nil
> return.
Free text?
I assume you mean FULL TEXT?
Did you copy the Full-text indices to the same place?
Did you enable full-text on the new database?
How was the data moved?
> Can anyone offer any help?
> --
> Confused but battling on
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Sorry I did mean full text search. We have tried to re create the indices
and the search but it still returns a nil result. The full text search
service is running.
How do you enable full text search on a database?
The database was moved by backing up to a device, then copying the device to
the new location and restoring it (changing the file locations etc).
Eeverything else in the database works fine; it is just this full text search
--
Confused but battling on
"Greg D. Moore (Strider)" wrote:
> "Madame Artois" <MadameArtois@.discussions.microsoft.com> wrote in message
> news:C3B84E7A-4085-4089-85B8-820174CC303E@.microsoft.com...
> > We have two SQL Server 2000 servers with SP4 loaded. We have copied a
> > database from one to the other. The free text search runs on the original
> > server and produces results but on the new server it runs but produces a
> > nil
> > return.
> Sorry I did mean Full Text Search.
The full text searches had been copied to the same place and I'm not sure
what you mean about enabling full test searches on the database.
The full text search service is running
> Free text?
> I assume you mean FULL TEXT?
> Did you copy the Full-text indices to the same place?
> Did you enable full-text on the new database?
> How was the data moved?
>
> >
> > Can anyone offer any help?
> >
> > --
> > Confused but battling on
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
>
>

Free Text Search

We have two SQL Server 2000 servers with SP4 loaded. We have copied a
database from one to the other. The free text search runs on the original
server and produces results but on the new server it runs but produces a nil
return.
Can anyone offer any help?
Confused but battling on"Madame Artois" <MadameArtois@.discussions.microsoft.com> wrote in message
news:C3B84E7A-4085-4089-85B8-820174CC303E@.microsoft.com...
> We have two SQL Server 2000 servers with SP4 loaded. We have copied a
> database from one to the other. The free text search runs on the original
> server and produces results but on the new server it runs but produces a
> nil
> return.
Free text?
I assume you mean FULL TEXT?
Did you copy the Full-text indices to the same place?
Did you enable full-text on the new database?
How was the data moved?

> Can anyone offer any help?
> --
> Confused but battling on
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Sorry I did mean full text search. We have tried to re create the indices
and the search but it still returns a nil result. The full text search
service is running.
How do you enable full text search on a database?
The database was moved by backing up to a device, then copying the device to
the new location and restoring it (changing the file locations etc).
Eeverything else in the database works fine; it is just this full text searc
h
--
Confused but battling on
"Greg D. Moore (Strider)" wrote:

> "Madame Artois" <MadameArtois@.discussions.microsoft.com> wrote in message
> news:C3B84E7A-4085-4089-85B8-820174CC303E@.microsoft.com...
> Sorry I did mean Full Text Search.
The full text searches had been copied to the same place and I'm not sure
what you mean about enabling full test searches on the database.
The full text search service is running
> Free text?
> I assume you mean FULL TEXT?
> Did you copy the Full-text indices to the same place?
> Did you enable full-text on the new database?
> How was the data moved?
>
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com [url]http://www.greenms.com/sqlserver.html[/ur
l]
>
>