Showing posts with label initial. Show all posts
Showing posts with label initial. Show all posts

Wednesday, March 28, 2012

Problem Replication With DTS

I have transactional replication with DTS in SQL 2000.
In the initial snapshop i got de next error (trasnlate fron de spanish) " The process found invalid column date in the bcp file -path-".
I review the bcp file but i didn't found spacial characters. In order to discard DTS problems, the DTS had only the defult transformations that the SQL creates for it.
The problem does not appear when i don't use DTS with the same data and conditions.
Somebody has anay idea about this error?
Thank you.
what was the error number?
I am afraid your English is too poor for me to understand (and my Spanish is
too bad as well) what you are trying to do and what the problem is. Can you
post this in Spanish for me, and I'll have it translated into English and
then post back in Spanish?
cul era el nmero del error? Estoy asustado que su ingls es demasiado
pobre para que entienda lo que usted est intentando hacer y cules es el
problema. Puede usted fijar esto en espaol para m, y m voluntad para
tenerla traducida a ingls y despus para fijarla detrs en espaol?
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Rsantacruz" <Rsantacruz@.discussions.microsoft.com> wrote in message
news:E6D5EDE0-1481-4FDA-94B6-9C21AA24EB4A@.microsoft.com...
> I have transactional replication with DTS in SQL 2000.
> In the initial snapshop i got de next error (trasnlate fron de spanish) "
The process found invalid column date in the bcp file -path-".
> I review the bcp file but i didn't found spacial characters. In order to
discard DTS problems, the DTS had only the defult transformations that the
SQL creates for it.
> The problem does not appear when i don't use DTS with the same data and
conditions.
> Somebody has anay idea about this error?
> Thank you.
|||Thank you for your time Hilary and sorry for my English.
I have the next Transactional replication problems:
1) I performed transactional replication to Oracle subscriber.
The subscriber was configured using Micrososft OLE DB provider for Oracle, because I need to use DTS to transform the data before applying it to Oracle.
In the initial snatshop I got error (windows error) with distrib.exe:
The instruction at '<address>' referenced memory at '<address>'.
The memory could not be "read"
Click OK to terminate the program.
This problem appears with a table with a few rows. The only that I saw in the bcp file is that, there is some char(255) fields with blanks (like char(13), or returns in Word), when I removed some of this blanks from the bcp file and restart the synchro
nization the things go fine.
When I do the same replication of the same data to SQL subscriber it's fine too.
2) The second problem with other table that I got: having the same conditions as described previously
In the initial snatshop I got error (replication error)
"The process encountered invalid column data in bcp file -PATH-"
Not error number and nothing more in the error description.
And the same, when I saw the bcp file and cut some blanks in field (character field) the things go fine.
With SQL subscriber, it's fine too.
I did not use DTS in this case but the result is the same.
I reinstalled SQL SP3 and Win2000 SP4 and I got the same result.
I don't know if there is a some deficiency with OLE DB providers when you used them with replication.
If you know how to resolve this problem, please say me.
Thank yoo for your time, and sorry for this long post.

Monday, February 20, 2012

Problem inserting data into SQL Server 2000

Tryinna insert a new row

This is my code:
Dim myConn As SqlConnection
Dim mycmd As SqlCommand
myConn = New SqlConnection("Initial Catalog=science;" & _
"Data Source=localhost;Integrated Security=SSPI;")
mycmd = New SqlCommand("INSERT into STEP1(firstname) VALUES('Amin')", myConn)
myConn.Open()
mycmd.ExecuteNonQuery()
myConn.Close()

This is the error message I get:
The name 'firstname' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.Are you certain STEP1 is a table name? Can you run the same SQL in Query Analyzer and see what happens?|||Thank you Douglas... you made me use SQL Query Analyzer which I never used before, it's a very nice progie..

OK, I tried the following code and run it:
USE science
INSERT into STEP1(firstname) VALUES('Amin')

And the message I got:
(1 row(s) affected)

So I was amazed with the result and checked it for becoming sure. I opened Enterprise Manager, opened my table named STEP1 and... guess what? a new row with the firstname of 'Amin' and NULL for the remaining fields...

Oh my God!! plz help me... this asp.net thang is getting me old! When am I gonna learn it??|||Maybe you could try enclosing the table and column names in square brackets:


mycmd = New SqlCommand("INSERT into [STEP1]([firstname]) VALUES('Amin')", myConn)

Terri|||Thank you very much for the tip Terri

I found why this error occurs but still don't know how to solve it

I've used a function located in a self-made namespace:

Function newUser(ByVal firstname As String, ByVal surname As String, ByVal title As String,
ByVal gender As String, ByVal birthday As Integer, ByVal country As String, ByVal city As String, ByVal state As String, ByVal username11 As String, ByVal pass As String, ByVal email As String)

Dim myConn As SqlConnection
Dim mycmd As SqlCommand

myConn = New SqlConnection(ConfigurationSettings.AppSettings("MyConnection1"))

mycmd = New SqlCommand("INSERT into [users_contact]([username],[pass],[email],[firstname],[surname],[title],[gender],[birthday],[country],[city],[state]) VALUES(username,pass,email,firstname,surname,title,gender,birthday,country,city,state)", myConn)

myConn.Open()
mycmd.ExecuteNonQuery()
myConn.Close()

End Function

Maybe I have to do some kind of conversion like ToString or something
Cz when I use 'string' instead of those variables, the insert command works properly.|||You initially said your statement looked like this:

mycmd = New SqlCommand("INSERT into STEP1(firstname) VALUES('Amin')", myConn)

And now you are saying that your statement looks like this:
mycmd = New SqlCommand("INSERT into [users_contact]([username],[pass],[email],[firstname],[surname],[title],[gender],[birthday],[country],[city],[state]) VALUES(username,pass,email,firstname,surname,title,gender,birthday,country,city,state)", myConn)

This is completely different. Please be sure to supply *exact* code in the future so that you can receive accurate help.

The solution to your problem is to use SQL parameters, like this:

mycmd = New SqlCommand("INSERT into [users_contact]([username],[pass],[email],[firstname],[surname],[title],[gender],[birthday],[country],[city],[state]) VALUES(@.username,@.pass,@.email,@.firstname,@.surname,@.title,@.gender,@.birthday,@.country,@.city,@.state)", myConn)

mycmd.Parameters.Add(New SqlParameter("@.username", SqlDbType.VarChar, 99))
mycmd.Parameters("@.username").Value = username

mycmd.Parameters.Add(New SqlParameter("@.pass", SqlDbType.VarChar, 99))
mycmd.Parameters("@.pass").Value = pass

mycmd.Parameters.Add(New SqlParameter("@.email", SqlDbType.VarChar, 99))
mycmd.Parameters("@.email").Value = email

<add the rest of the parameters here
myConn.Open()
mycmd.ExecuteNonQuery()
myConn.Close()

You will need to change the SqlDbType and length as appropriate for each of the parameters.

Terri|||WwWwWoOoOoOoOoOoWwWwWwWw.......

Thank you dear Terri...

How amazing you are......

It wroked!! It was been a long time I had this prob and couldn't find any useful article.. Go on and create a website with articles. hehee

Well, I don't know how to thank you...... anyway, thanks a lot!!

visit my website: www.aminsadeghi.com|||I am glad you got it working!

There are actually a lot of articles out there on this, but I know it can be difficult to find something when you are not really sure what you are looking for.

I suggest looking through theASP.NET Quickstart Tutorials, especiallyInserting Data into a SQL Database.

Terri|||I think the ConnectionString is wrong.
try any on bellow:

myConn = New SqlConnection("Persist Security Info=False;Integrated Security=SSPI;Server=(local);Database=science;")

or

myConn = New SqlConnection("Persist Security Info=False;Integrated Security=SSPI;Server=127.0.0.1;Database=science;")

or

myConn = New SqlConnection("Server=(local);Database=science;UID=sa;PWD=;")

or

myConn = New SqlConnection("Server=127.0.0.1;Database=science;UID=sa;PWD=;")|||Dear Yijun_lee,

The connection string is totally correct, it's calling the connection string from appSettings inside the web.config file.
If you wanna learn this new method, find and see the movie on http://msdn.microsoft.com/msdntv - Application Settings - Rob Howard

and Dear Terri,

You think I didn't search for it? as a matter of fact the problem is with Microsoft that doesn't offer free learning stuff for it's new programming language.
To get the answer of this question i had, i read the link you dropped for me, i remember i read that b4, but it only describes how to add 'data' data, and it didn't show how to insert untyped variables that u mentioned to make it look like this: @.variable and after that typing some SQL Parameters for it...
To learn this I even downloaded ASP.NET Kit... and nothing useful at all.

I believe now that Microsoft has built this very nice ASP.NET language, it has to do some work to make it comprehensive and popular.

Anyway special thanks to you dear Terri, Rob Howard (as an intellectual maker of ASP.NET) and ofcourse Bill Gates ;)