Showing posts with label inserting. Show all posts
Showing posts with label inserting. Show all posts

Wednesday, March 21, 2012

Error on inserting record on remote server

Hi,
I get this error when i insert a record from my local server to a
remote server.
Server: Msg 7391, Level 16, State 1, Procedure usp_insSO2NavAppV2, Line
14
The operation could not be performed because the OLE DB provider
'SQLOLEDB' was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the
specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
ITransactionJoin::JoinTransaction returned 0x8004d00a].
pls help me
from
Doller
MSDTC might not be started on one of the servers
Dandy Weyn
[MCSE-MCSA-MCDBA-MCDST-MCT]
http://www.dandyman.net
Check my SQL Server Resource Pages at http://www.dandyman.net/sql
"doller" <sufianarif@.gmail.com> wrote in message
news:1127785678.067089.75530@.o13g2000cwo.googlegro ups.com...
> Hi,
> I get this error when i insert a record from my local server to a
> remote server.
>
> Server: Msg 7391, Level 16, State 1, Procedure usp_insSO2NavAppV2, Line
> 14
> The operation could not be performed because the OLE DB provider
> 'SQLOLEDB' was unable to begin a distributed transaction.
> [OLE/DB provider returned message: New transaction cannot enlist in the
> specified transaction coordinator. ]
> OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
> ITransactionJoin::JoinTransaction returned 0x8004d00a].
>
> pls help me
> from
> Doller
>

Error on inserting record on remote server

Hi,
I get this error when i insert a record from my local server to a
remote server.
Server: Msg 7391, Level 16, State 1, Procedure usp_insSO2NavAppV2, Line
14
The operation could not be performed because the OLE DB provider
'SQLOLEDB' was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the
specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
ITransactionJoin::JoinTransaction returned 0x8004d00a].
pls help me
from
DollerMSDTC might not be started on one of the servers
Dandy Weyn
[MCSE-MCSA-MCDBA-MCDST-MCT]
http://www.dandyman.net
Check my SQL Server Resource Pages at http://www.dandyman.net/sql
"doller" <sufianarif@.gmail.com> wrote in message
news:1127785678.067089.75530@.o13g2000cwo.googlegroups.com...
> Hi,
> I get this error when i insert a record from my local server to a
> remote server.
>
> Server: Msg 7391, Level 16, State 1, Procedure usp_insSO2NavAppV2, Line
> 14
> The operation could not be performed because the OLE DB provider
> 'SQLOLEDB' was unable to begin a distributed transaction.
> [OLE/DB provider returned message: New transaction cannot enlist in th
e
> specified transaction coordinator. ]
> OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
> ITransactionJoin::JoinTransaction returned 0x8004d00a].
>
> pls help me
> from
> Doller
>

Sunday, March 11, 2012

Error number for duplicate column value during an insert for a unique column ?

I have a table in which a non-primary key column has a unique index on it.

If I am inserting a record into this table with a duplicate column value for the indexed column, then what will be the error number of the error in above scenario? OR How could I find this out?

Open a query analyzer and try to manually insert a value into the table and see what SQL complains..

|||

The error number for inserting duplicate value in a column of unique index is : 2601.

Friday, March 9, 2012

error no in dynamic sql

to find @.error in dynamic sql

I have a temp table in my stored procedure. I tried inserting into the temp table thro dynamic sql. upto this is fine. Now i want to find if there is any error in my sql query. How to check this.

i have added the code below

CREATE PROCEDURE USP_RULE
AS
create table #TABLE1
(
SlNo int identity(1,1), EqNum varchar(25),Pointnum varchar(25)
)
declare @.EqNum varchar(25),@.Pointnum varchar(25)
DECLARE @.STRDBNAME VARCHAR(50)
SET @.STRDBNAME = 'DB1'
EXEC('insert into '+#TABLE1+' select EQNUM,POINTNUM from '+@.STRDBNAME+'..TABLE2')

IF (@.@.ERROR > 0)
BEGIN
RAISERROR ('ERROR')
END

GOYou cannot use temporary table inside exec, try this idea:

insert into #TABLE1
EXEC('select EQNUM,POINTNUM from '+@.STRDBNAME+'..TABLE2')|||I'd suggest that you turn your EXEC into a SELECT just long enough to see what is worng (!).

-PatP|||I think jtamil2001 was referring to error checking, not that s/he is getting one already. SNAIL's suggestion is the one that the poster was after. And then, if INSERT fails, @.@.ERROR will contain the corresponding value. I'd also wrap it all into a transaction:

begin tran
insert into #TABLE1
EXEC('select EQNUM,POINTNUM from '+@.STRDBNAME+'..TABLE2')

IF (@.@.ERROR > 0) BEGIN
RAISERROR ('ERROR')
rollback tran
return (1)
END
commit tran|||Originally posted by rdjabarov
I think jtamil2001 was referring to error checking, not that s/he is getting one already. SNAIL's suggestion is the one that the poster was after. And then, if INSERT fails, @.@.ERROR will contain the corresponding value. I'd also wrap it all into a transaction:

begin tran
EXEC('insert into '+#TABLE1+' select EQNUM,POINTNUM from '+@.STRDBNAME+'..TABLE2')

IF (@.@.ERROR > 0) BEGIN
RAISERROR ('ERROR')
rollback tran
return (1)
END
commit tran

Why it needs transaction for one command?

Friday, February 24, 2012

Error Message Question..

Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.

got this error message while inseting data in my database...how can i solve this?...can anybody explain how can i solve this problem...and im sorry but i cant understand the codes thoroughly..please explain briefly...thank u...

You have some control (presentation control) which is using SqlDataSource1 as source of data.

However, when your presentation control try to insert some data, it fails, because you did not specify which command to use when inserting data.

You need to complete definition of SqlDataSource1 or Adapter by specifyingInsertCommand