Hi,
I'm trying to create a new table by merging two files together. They both
have exactly the same table structure. I.e. they are both got 1 field called
ref varchar(255).
The code I'm using is:
INSERT U_T_XmasOnly(REF)
SELECT DISTINCT ref
FROM U_T_AttXmasOnly
UNION
SELECT DISTINCT ref
FROM U_T_BlkXmasOnly
The error message I'm getting is:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'U_T_XmasOnly'.
Can you please tell me what I'm doing wrong?
Thanks in advance
RobRobert
I think you missed INTO within the INSERT statement
It shoul be
INSERT INTO U_T_XmasOnly(REF)
"Robert" <Robert@.discussions.microsoft.com> wrote in message
news:8C2270C4-0CC1-45BB-95D4-C4539A00C1BB@.microsoft.com...
> Hi,
> I'm trying to create a new table by merging two files together. They both
> have exactly the same table structure. I.e. they are both got 1 field
called
> ref varchar(255).
> The code I'm using is:
> INSERT U_T_XmasOnly(REF)
> SELECT DISTINCT ref
> FROM U_T_AttXmasOnly
> UNION
> SELECT DISTINCT ref
> FROM U_T_BlkXmasOnly
> The error message I'm getting is:
>
> Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'U_T_XmasOnly'.
> Can you please tell me what I'm doing wrong?
> Thanks in advance
> Rob|||The INTO is optional, so the INSERT statement is fine, as long as the table
already exists. Your object 'U_T_XmasOnly' musn't exist.
Looking at your statement "I'm trying to create a table" I think what you
want to do is this:
SELECT ref
INTO U_T_XmasOnly
FROM
(
SELECT DISTINCT ref
FROM U_T_AttXmasOnly
UNION
SELECT DISTINCT ref
FROM U_T_BlkXmasOnly
) x
But what you should really do is create your table first, then use the
INSERT syntax above:
eg
CREATE TABLE U_T_XmasOnly ( ref INT) -- other columns etc
INSERT U_T_XmasOnly(REF)
SELECT DISTINCT ref
FROM U_T_AttXmasOnly
UNION
SELECT DISTINCT ref
FROM U_T_BlkXmasOnly
Basically the syntax for adding records to an _existing_ table is the
INSERT, creating a table on they fly and adding records at the same time is
the SELECT INTO, and really you should create the table first, then add the
records, using the CREATE TABLE and INSERT.
Let me know how get on.
Damien
"Uri Dimant" wrote:
> Robert
> I think you missed INTO within the INSERT statement
> It shoul be
> INSERT INTO U_T_XmasOnly(REF)
> "Robert" <Robert@.discussions.microsoft.com> wrote in message
> news:8C2270C4-0CC1-45BB-95D4-C4539A00C1BB@.microsoft.com...
> called
>
>|||Hehehe, right , I have never thought about it.
"Damien" <Damien@.discussions.microsoft.com> wrote in message
news:45A4A9EE-A080-45AC-85E7-E3DC24EB2BD6@.microsoft.com...
> The INTO is optional, so the INSERT statement is fine, as long as the
table
> already exists. Your object 'U_T_XmasOnly' musn't exist.
> Looking at your statement "I'm trying to create a table" I think what you
> want to do is this:
> SELECT ref
> INTO U_T_XmasOnly
> FROM
> (
> SELECT DISTINCT ref
> FROM U_T_AttXmasOnly
> UNION
> SELECT DISTINCT ref
> FROM U_T_BlkXmasOnly
> ) x
> But what you should really do is create your table first, then use the
> INSERT syntax above:
> eg
> CREATE TABLE U_T_XmasOnly ( ref INT) -- other columns etc
> INSERT U_T_XmasOnly(REF)
> SELECT DISTINCT ref
> FROM U_T_AttXmasOnly
> UNION
> SELECT DISTINCT ref
> FROM U_T_BlkXmasOnly
> Basically the syntax for adding records to an _existing_ table is the
> INSERT, creating a table on they fly and adding records at the same time
is
> the SELECT INTO, and really you should create the table first, then add
the
> records, using the CREATE TABLE and INSERT.
> Let me know how get on.
>
> Damien
> "Uri Dimant" wrote:
>
both
Showing posts with label files. Show all posts
Showing posts with label files. Show all posts
Monday, March 26, 2012
Monday, March 12, 2012
Invalid column name using BCP
Hi,
Sarah,
I am having trouble creating the data files. I received the error that there is an invalid column name 'Name' when using the BCP to create the files. How can I find out where this error is coming from?
Thanks
Quote:
Originally Posted by sarah21
Hi,
I am having trouble creating the data files. I received the error that there is an invalid column name 'Name' when using the BCP to create the files. How can I find out where this error is coming from?
Thanks
Sarah,
Name is a funny word in SQL Server as it is also a programming command and that is why you may be experiencing problems, try putting the column name in [] or change column name to be something more meaingfull like FullName.
Hope that helps
Sunday, February 19, 2012
Interop.SQLMERGXLib.dll
How did you use regsvr? I think something like this
should work:
regsvr32.exe "c:\program files\microsoft sql server\80
\com\sqlmergx.dll"
This article can be used for some general help, but it
looks like you have the correct references:
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;319646
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Hi Paul,
indeed I've already read the article, but I've still the problem. The
command that I've launch is:
regsvr32.exe {mypath}\Interop.SQLMERGXLib.dll
and I obtain the following error:
... .dll was loaded, but the DllRegistreServer entry point was not found.
This file can not be registered.
I've looked also for sqlmergx.dll but I haven't found it on my PC... where
should I find it? Is it available in Internet? Do you think it will solve my
problem?
Thanks again
"Paul Ibison" wrote:
> How did you use regsvr? I think something like this
> should work:
> regsvr32.exe "c:\program files\microsoft sql server\80
> \com\sqlmergx.dll"
> This article can be used for some general help, but it
> looks like you have the correct references:
> http://support.microsoft.com/default.aspx?scid=kb;EN-
> US;319646
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Hi Paul,
I didn't find sqlmergx.dll in the path that you have written, so I've copied
one from another SQL Server installation and then registered it with
regsrvr32: the registration succeded but when I launch my procedure I obtain
the following error:
... Check to see if the component is registered correctly
although the registration is correct.
I precise that I have already done all your suggestion that you have
explained.
Can you still help me? I precise also that on my computer I've installed
only MSDE and not all SQL Server...
"Paul Ibison" wrote:
> It should be in c:\program files\microsoft sql server\80
> \com\
> However it is not prefixed with Interop.
> Inside the Visual C# .NET project, you add a reference to
> the Microsoft SQL Merge Control 8.0 COM object, and then
> add the following code:
> using System;
> using System.Runtime.InteropServices;
> using SQLMERGXLib;
> As far as I recall, adding the reference imports the type
> library, so assuming the COM object is registered (it
> should be from the SQL Installation) there's no need to
> use regsvr32.exe
> HTH,
> Paul Ibison
>
|||Siu,
sorry about this but I can't do much more. I don't have
VS installed in my current position. Some others here
might take up the thread, but if not I would suggest that
you post this in a C# group, as it is more of a COM
interoperability problem.
HTH,
Paul Ibison
|||thank you anyway.
I appreciated very much your help
"Paul Ibison" wrote:
> Siu,
> sorry about this but I can't do much more. I don't have
> VS installed in my current position. Some others here
> might take up the thread, but if not I would suggest that
> you post this in a C# group, as it is more of a COM
> interoperability problem.
> HTH,
> Paul Ibison
>
should work:
regsvr32.exe "c:\program files\microsoft sql server\80
\com\sqlmergx.dll"
This article can be used for some general help, but it
looks like you have the correct references:
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;319646
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Hi Paul,
indeed I've already read the article, but I've still the problem. The
command that I've launch is:
regsvr32.exe {mypath}\Interop.SQLMERGXLib.dll
and I obtain the following error:
... .dll was loaded, but the DllRegistreServer entry point was not found.
This file can not be registered.
I've looked also for sqlmergx.dll but I haven't found it on my PC... where
should I find it? Is it available in Internet? Do you think it will solve my
problem?
Thanks again
"Paul Ibison" wrote:
> How did you use regsvr? I think something like this
> should work:
> regsvr32.exe "c:\program files\microsoft sql server\80
> \com\sqlmergx.dll"
> This article can be used for some general help, but it
> looks like you have the correct references:
> http://support.microsoft.com/default.aspx?scid=kb;EN-
> US;319646
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Hi Paul,
I didn't find sqlmergx.dll in the path that you have written, so I've copied
one from another SQL Server installation and then registered it with
regsrvr32: the registration succeded but when I launch my procedure I obtain
the following error:
... Check to see if the component is registered correctly
although the registration is correct.
I precise that I have already done all your suggestion that you have
explained.
Can you still help me? I precise also that on my computer I've installed
only MSDE and not all SQL Server...
"Paul Ibison" wrote:
> It should be in c:\program files\microsoft sql server\80
> \com\
> However it is not prefixed with Interop.
> Inside the Visual C# .NET project, you add a reference to
> the Microsoft SQL Merge Control 8.0 COM object, and then
> add the following code:
> using System;
> using System.Runtime.InteropServices;
> using SQLMERGXLib;
> As far as I recall, adding the reference imports the type
> library, so assuming the COM object is registered (it
> should be from the SQL Installation) there's no need to
> use regsvr32.exe
> HTH,
> Paul Ibison
>
|||Siu,
sorry about this but I can't do much more. I don't have
VS installed in my current position. Some others here
might take up the thread, but if not I would suggest that
you post this in a C# group, as it is more of a COM
interoperability problem.
HTH,
Paul Ibison
|||thank you anyway.
I appreciated very much your help
"Paul Ibison" wrote:
> Siu,
> sorry about this but I can't do much more. I don't have
> VS installed in my current position. Some others here
> might take up the thread, but if not I would suggest that
> you post this in a C# group, as it is more of a COM
> interoperability problem.
> HTH,
> Paul Ibison
>
Subscribe to:
Posts (Atom)