HomeForum
Welcome, Guest

Connection is busy with results...
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Connection is busy with results...

Connection is busy with results... 3 years, 2 months ago #602

  • KKimble
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
I cannot import records into a table that has a trigger. I get an ODBC error \"Connection is busy with results for another command\". Is there a way to make this work?

The following should reproduce my error in a very simplified scenario. I am using a Microsoft SQL 2005 Server on Windows 2000 and am using an ODBC connection to it.

1.) Use the script below to create two tables on a SQL server.
2.) Create a small text file with about 10 firstname,lastname records in it like:
Jim,Dandy
My,Name
Jolly,Jackson
etc...
3.) Create a transformation to import those records into the \"deleteme\" table. I really need to \"Add New and Update Old\" records but for the test the writer can be set to \"Add New Records.\"

When you run the import, you should get an error after the first record is imported.

Below is the script to create the test tables:
CREATE TABLE [dbo].[deleteme](
[FirstName] [varchar](100) NOT NULL,
[LastName] [varchar](100) NOT NULL
);
GO
ALTER TABLE [dbo].[deleteme] ADD CONSTRAINT [PK_deleteme] PRIMARY KEY CLUSTERED
(
[LastName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]

go

SET ANSI_PADDING OFF
CREATE TABLE [dbo].[deleteme2](
[TableName] [varchar](50) NOT NULL,
[FieldName] [varchar](20) NOT NULL,
[NewValue] [varchar](100) NOT NULL,
[ChangeDate] datetime NOT NULL
)
GO

create Trigger [dbo].[deleteme_AuditInsert] ON [dbo].[deleteme]
FOR INSERT
AS
Insert into deleteme2 (TableName, FieldName, NewValue, ChangeDate)
Select 'deleteme' , 'FirstName', i.FirstName, GetDate() from Inserted i
Insert into deleteme2 (TableName, FieldName, NewValue, ChangeDate)
Select 'deleteme' , 'LastName', i.LastName, GetDate() from Inserted i

Thanks,
Kelly

Re:Connection is busy with results... 3 years, 2 months ago #603

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2183
  • Karma: 12
Two possible solutions

Modify your trigger by adding

SET NOCOUNT ON

Use sql before and put

SET NOCOUNT ON
GO

please let us know the outcome

Peter

Re:Connection is busy with results... 3 years, 2 months ago #604

  • KKimble
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
Putting it in the SQL Before worked great!
I'll also have the triggers updated with that just to cover all bases.

Thank you!
Kelly
  • Page:
  • 1
Time to create page: 0.19 seconds

Testimonials

I had my first upload running within 10 minutes of installing Visual Importer ETL

Gene Kovacs,
Director of Technical Business Operations,
A2B

User Login

You only need to log in or register to use our support forum



Our customers

BP

BBC

HSBC


Databases we work with

Go to top