Showing posts with label task. Show all posts
Showing posts with label task. Show all posts

Tuesday, March 27, 2012

Error Redirected to Script Component : Package Doesnt fail.

I have created a data flow task. In that, in a 'data conversion', if a column fails validation then that row is redirected to a script component, which in turn writes the error to a variable.

But though the error is generated and script component receives the error, package doesnt fail.

Is there any way to set the package result to failure inside the script component? I tried set 'FailPackageOnFailure' to true but doesnt work.

Any help is greatly appreciated.

Thanks,

Don

donMahya wrote:

I have created a data flow task. In that, in a 'data conversion', if a column fails validation then that row is redirected to a script component, which in turn writes the error to a variable.

But though the error is generated and script component receives the error, package doesnt fail.

Is there any way to set the package result to failure inside the script component? I tried set 'FailPackageOnFailure' to true but doesnt work.

Any help is greatly appreciated.

Thanks,

Don

You could raise an error within the script component using:

Me.Events.FireError(...) (something like that anyway)

-Jamie

|||

Sorry for the delay. Wasnt working on this part for some time.

I tried

Me.ComponentMetaData.FireError(0, "", strErrDesc, "", 0, True) - Where strErrDesc is error decription.

but still no luck

I tried setting the maxerrorcount to 0 but No Luck. Package still completes without any failure.

Any help or ideas are greatly appreciated.

Thanks,

Don

|||

You should return the failure value inside of your script main method. I do not remember the exact enumeration value but the intellisence will give it to you.

Thanks.

Error Redirected to Script Component : Package Doesnt fail.

I have created a data flow task. In that, in a 'data conversion', if a column fails validation then that row is redirected to a script component, which in turn writes the error to a variable.

But though the error is generated and script component receives the error, package doesnt fail.

Is there any way to set the package result to failure inside the script component? I tried set 'FailPackageOnFailure' to true but doesnt work.

Any help is greatly appreciated.

Thanks,

Don

donMahya wrote:

I have created a data flow task. In that, in a 'data conversion', if a column fails validation then that row is redirected to a script component, which in turn writes the error to a variable.

But though the error is generated and script component receives the error, package doesnt fail.

Is there any way to set the package result to failure inside the script component? I tried set 'FailPackageOnFailure' to true but doesnt work.

Any help is greatly appreciated.

Thanks,

Don

You could raise an error within the script component using:

Me.Events.FireError(...) (something like that anyway)

-Jamie

|||

Sorry for the delay. Wasnt working on this part for some time.

I tried

Me.ComponentMetaData.FireError(0, "", strErrDesc, "", 0, True) - Where strErrDesc is error decription.

but still no luck

I tried setting the maxerrorcount to 0 but No Luck. Package still completes without any failure.

Any help or ideas are greatly appreciated.

Thanks,

Don

|||

You should return the failure value inside of your script main method. I do not remember the exact enumeration value but the intellisence will give it to you.

Thanks.

error redirect to one file

Hi!

I have several lookups in my data flow task and for each of these I want to redirect error to one file (append data)

I created Flat File connection manager and first lookup goes fine with errors redirected to the file.

However, second error redirect that I am sending to the same file is failing.

Error I get is:

"[Flat File Destination 1 [14851]] Warning: The process cannot access the file because it is being used by another process.”

So my goal is to have one central file where I would redirect all records that fail.

thanks

Take all of the lookup error outputs and combine them with a union all component. Then, from the union all component go into your flat file destination.sql

Error read data from Sybase with SSIS 2005

Hi to All,
I am in process of transfering data from Sybase to Sql Server using
Microsoft Visual Studio 2005
have taken a Data Flow Task in Control Flow tab
In Data flow tab, I have taken one Ole DB Source
I am using Sybase Adaptive Server Anywhere Provider 9.0
In Ole Db Source Editor ,
For OLe Db Connection Manager, I choose Sybase Connection
For Data access mode, I choose Table or View
For Name of the table or the view, I choose a table by name Table1( it
lists all the tables from Sybase database)
When i click on preview button or Columns link, I get the following
Error
________________________________
TITLE: Microsoft Visual Studio
--
Error at Data Flow Task [OLE DB Source [215]]: An OLE DB error has
occurred. Error code: 0x80040E21.
Error at Data Flow Task [OLE DB Source [215]]: Unable to retrieve
column information from the data source. Make sure your target table in
the database is available.
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC020204A
(Microsoft.SqlServer.DTSPipelineWrap)
___________________________________
I've tried to install "ODBC .NET Data Provider"
but it wasn't tested with Sybase and it doesn't work.
Could anyone help me please?
Thanks
SalmecFirst, make sure that you can connect to the Sybase system by setting up a
linked server in SQL 2005 (take SSIS out of the picture). If that fails,
check www.connectionstrings.com to see if you're missing something in the
connection string. I assume you have the sybase client installed on the SSIS
box? It would need to be the same if SQL Server were on a different server.
If you can make that connection and make a simple query of the table, beware
of implicit data type conversions. I've had problems doing just this sort of
thing with Sybase when it came to the "money" datatype. You'd think that
since Sybase and SQL Server have a money type that it would work fine. Um,
no. So if you can get it to work as a linked server, try eliminating fields
(especially those that have some uncommon data type).
Hope that helps a bit.
"Sal" <salmec@.gmail.com> wrote in message
news:1152175894.975209.80120@.m73g2000cwd.googlegroups.com...
> Hi to All,
> I am in process of transfering data from Sybase to Sql Server using
> Microsoft Visual Studio 2005
> have taken a Data Flow Task in Control Flow tab
> In Data flow tab, I have taken one Ole DB Source
> I am using Sybase Adaptive Server Anywhere Provider 9.0
> In Ole Db Source Editor ,
> For OLe Db Connection Manager, I choose Sybase Connection
> For Data access mode, I choose Table or View
> For Name of the table or the view, I choose a table by name Table1( it
> lists all the tables from Sybase database)
> When i click on preview button or Columns link, I get the following
> Error
> ________________________________
> TITLE: Microsoft Visual Studio
> --
> Error at Data Flow Task [OLE DB Source [215]]: An OLE DB error has
> occurred. Error code: 0x80040E21.
> Error at Data Flow Task [OLE DB Source [215]]: Unable to retrieve
> column information from the data source. Make sure your target table in
> the database is available.
>
> --
> ADDITIONAL INFORMATION:
> Exception from HRESULT: 0xC020204A
> (Microsoft.SqlServer.DTSPipelineWrap)
> ___________________________________
> I've tried to install "ODBC .NET Data Provider"
> but it wasn't tested with Sybase and it doesn't work.
> Could anyone help me please?
> Thanks
> Salmec
>|||Hi James,
thanks for your interesting...
i resolved the problem:
i choose the "SSIS import and export Wizard" procedure (project menu)
At th first step - choose a Data Source - I choose ".Net Framework Data
Provider for Odbc"
As destination i've a SQL Native Client
I write a query to select the column tha i would like to import;
I choose the destination table
and after click Finish button
This procedure create a new package that import and convert the data.
and it works
Thanks to all
Sal

Error read data from Sybase with SSIS 2005

Hi to All,
I am in process of transfering data from Sybase to Sql Server using
Microsoft Visual Studio 2005
have taken a Data Flow Task in Control Flow tab
In Data flow tab, I have taken one Ole DB Source
I am using Sybase Adaptive Server Anywhere Provider 9.0
In Ole Db Source Editor ,
For OLe Db Connection Manager, I choose Sybase Connection
For Data access mode, I choose Table or View
For Name of the table or the view, I choose a table by name Table1( it
lists all the tables from Sybase database)
When i click on preview button or Columns link, I get the following
Error
________________________________
TITLE: Microsoft Visual Studio
--
Error at Data Flow Task [OLE DB Source [215]]: An OLE DB error has
occurred. Error code: 0x80040E21.
Error at Data Flow Task [OLE DB Source [215]]: Unable to retrieve
column information from the data source. Make sure your target table in
the database is available.
--
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC020204A
(Microsoft.SqlServer.DTSPipelineWrap)
___________________________________
I've tried to install "ODBC .NET Data Provider"
but it wasn't tested with Sybase :( and it doesn't work.
Could anyone help me please?
Thanks
SalmecFirst, make sure that you can connect to the Sybase system by setting up a
linked server in SQL 2005 (take SSIS out of the picture). If that fails,
check www.connectionstrings.com to see if you're missing something in the
connection string. I assume you have the sybase client installed on the SSIS
box? It would need to be the same if SQL Server were on a different server.
If you can make that connection and make a simple query of the table, beware
of implicit data type conversions. I've had problems doing just this sort of
thing with Sybase when it came to the "money" datatype. You'd think that
since Sybase and SQL Server have a money type that it would work fine. Um,
no. So if you can get it to work as a linked server, try eliminating fields
(especially those that have some uncommon data type).
Hope that helps a bit.
"Sal" <salmec@.gmail.com> wrote in message
news:1152175894.975209.80120@.m73g2000cwd.googlegroups.com...
> Hi to All,
> I am in process of transfering data from Sybase to Sql Server using
> Microsoft Visual Studio 2005
> have taken a Data Flow Task in Control Flow tab
> In Data flow tab, I have taken one Ole DB Source
> I am using Sybase Adaptive Server Anywhere Provider 9.0
> In Ole Db Source Editor ,
> For OLe Db Connection Manager, I choose Sybase Connection
> For Data access mode, I choose Table or View
> For Name of the table or the view, I choose a table by name Table1( it
> lists all the tables from Sybase database)
> When i click on preview button or Columns link, I get the following
> Error
> ________________________________
> TITLE: Microsoft Visual Studio
> --
> Error at Data Flow Task [OLE DB Source [215]]: An OLE DB error has
> occurred. Error code: 0x80040E21.
> Error at Data Flow Task [OLE DB Source [215]]: Unable to retrieve
> column information from the data source. Make sure your target table in
> the database is available.
>
> --
> ADDITIONAL INFORMATION:
> Exception from HRESULT: 0xC020204A
> (Microsoft.SqlServer.DTSPipelineWrap)
> ___________________________________
> I've tried to install "ODBC .NET Data Provider"
> but it wasn't tested with Sybase :( and it doesn't work.
> Could anyone help me please?
> Thanks
> Salmec
>|||Hi James,
thanks for your interesting...
i resolved the problem:
i choose the "SSIS import and export Wizard" procedure (project menu)
At th first step - choose a Data Source - I choose ".Net Framework Data
Provider for Odbc"
As destination i've a SQL Native Client
I write a query to select the column tha i would like to import;
I choose the destination table
and after click Finish button
This procedure create a new package that import and convert the data.
and it works
Thanks to all
Salsql

Monday, March 26, 2012

Error Output for SQL Server Destination

I'm in the process of running some tests to determine which method is faster...

I created a data flow task OleDB Source -> Data Conversion -> OleDb Destination. Error outputs from the OleDB destination is sent to a flat file destination. This works great.

I'm importing millons of rows and found that using SQL Server Destination (local) is much faster than the OleDB Destination. However, I have not figured out how to output errors to a flat file destination like I did when using the OleDB destination.

Is there any way to trap errors in a flat file when using a SQL Server Destination?

Thanks!

NLC

OK..I found the answer to my problem. Books online indicates that SQL Server destination does not support an error output. I guess I'll have to use OleDB destination instead.

NLC

Error opening VSA from Script component and Script Task

TITLE: Microsoft Visual Studio

Cannot show Visual Studio for Applications editor.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2005&ProdVer=8.0.50727.42&EvtSrc=Microsoft.DataTransformationServices.DataFlowUI.SR&EvtID=CouldNotShowVsaIDE&LinkId=20476


ADDITIONAL INFORMATION:

Engine returned Unknown Error (Microsoft.VisualBasic.Vsa)

A project with the name 'ScriptComponent_972bfcb1f5ae462081f39130ba1d36b2' already exists.


BUTTONS:

OK

This happened immediately AFTER installing Visual Studio 2005. SQL Serve Workstation tools were already installed. I am running Windows XP SP2.

Anyway have any words of wisdon as to what the problem may be or how to investigate fix it?

Thanks

Jamie

Ignore this. Rebooting has solved it!!!

-Jamie

|||

Jamie,

I've got similar message which is persistent. I cannot open any script task anymore

Error message "Cannot show the editor for this task. Specified cast is not valid (Microsoft.VisualBasic.Vsa.DT)" pops up.

I even retried re-installing VS 2005. Did not resolved the issue.

Any idea?

Gulden

|||

Try to upgrade your machine with the cumulative hotfix package (build 2153) for SQL Server 2005.

Regards,
Yitzhak

|||

Yitzak,

Thank you for your answer.

I am getting "This machine does not have a product that matches this installation package"

on the first one in x86 group.

Do you have any idea?

This is my only chance.

I've re-installed SQL Server 2005 and Visual Studio 2005. Still cannot open the scripts.

Gulden

|||

Even betterjust exit out of VS2005 and go back in. That solved it for me.

Jeff

|||

In my case they had pushed DLLs in 600 people's banded machines in my company including vbscript.dll etc. by mistake. They resolved it by re-registering them

Gulden

|||

You need to install SP1 for MS SQL Server 2005 as a prerequisite before you will be able to upgrade your machine with the cumulative hotfix package (build 2153) for SQL Server 2005. SO it is a 2 steps process.

Regards,
Yitzhak

Error opening VSA from Script component and Script Task

TITLE: Microsoft Visual Studio

Cannot show Visual Studio for Applications editor.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2005&ProdVer=8.0.50727.42&EvtSrc=Microsoft.DataTransformationServices.DataFlowUI.SR&EvtID=CouldNotShowVsaIDE&LinkId=20476


ADDITIONAL INFORMATION:

Engine returned Unknown Error (Microsoft.VisualBasic.Vsa)

A project with the name 'ScriptComponent_972bfcb1f5ae462081f39130ba1d36b2' already exists.


BUTTONS:

OK

This happened immediately AFTER installing Visual Studio 2005. SQL Serve Workstation tools were already installed. I am running Windows XP SP2.

Anyway have any words of wisdon as to what the problem may be or how to investigate fix it?

Thanks

Jamie

Ignore this. Rebooting has solved it!!!

-Jamie

|||

Jamie,

I've got similar message which is persistent. I cannot open any script task anymore

Error message "Cannot show the editor for this task. Specified cast is not valid (Microsoft.VisualBasic.Vsa.DT)" pops up.

I even retried re-installing VS 2005. Did not resolved the issue.

Any idea?

Gulden

|||

Try to upgrade your machine with the cumulative hotfix package (build 2153) for SQL Server 2005.

Regards,
Yitzhak

|||

Yitzak,

Thank you for your answer.

I am getting "This machine does not have a product that matches this installation package"

on the first one in x86 group.

Do you have any idea?

This is my only chance.

I've re-installed SQL Server 2005 and Visual Studio 2005. Still cannot open the scripts.

Gulden

|||

Even betterjust exit out of VS2005 and go back in. That solved it for me.

Jeff

|||

In my case they had pushed DLLs in 600 people's banded machines in my company including vbscript.dll etc. by mistake. They resolved it by re-registering them

Gulden

|||

You need to install SP1 for MS SQL Server 2005 as a prerequisite before you will be able to upgrade your machine with the cumulative hotfix package (build 2153) for SQL Server 2005. SO it is a 2 steps process.

Regards,
Yitzhak

Error opening VSA from Script component and Script Task

TITLE: Microsoft Visual Studio

Cannot show Visual Studio for Applications editor.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2005&ProdVer=8.0.50727.42&EvtSrc=Microsoft.DataTransformationServices.DataFlowUI.SR&EvtID=CouldNotShowVsaIDE&LinkId=20476


ADDITIONAL INFORMATION:

Engine returned Unknown Error (Microsoft.VisualBasic.Vsa)

A project with the name 'ScriptComponent_972bfcb1f5ae462081f39130ba1d36b2' already exists.


BUTTONS:

OK

This happened immediately AFTER installing Visual Studio 2005. SQL Serve Workstation tools were already installed. I am running Windows XP SP2.

Anyway have any words of wisdon as to what the problem may be or how to investigate fix it?

Thanks

Jamie

Ignore this. Rebooting has solved it!!!

-Jamie

|||

Jamie,

I've got similar message which is persistent. I cannot open any script task anymore

Error message "Cannot show the editor for this task. Specified cast is not valid (Microsoft.VisualBasic.Vsa.DT)" pops up.

I even retried re-installing VS 2005. Did not resolved the issue.

Any idea?

Gulden

|||

Try to upgrade your machine with the cumulative hotfix package (build 2153) for SQL Server 2005.

Regards,
Yitzhak

|||

Yitzak,

Thank you for your answer.

I am getting "This machine does not have a product that matches this installation package"

on the first one in x86 group.

Do you have any idea?

This is my only chance.

I've re-installed SQL Server 2005 and Visual Studio 2005. Still cannot open the scripts.

Gulden

|||

Even betterjust exit out of VS2005 and go back in. That solved it for me.

Jeff

|||

In my case they had pushed DLLs in 600 people's banded machines in my company including vbscript.dll etc. by mistake. They resolved it by re-registering them

Gulden

|||

You need to install SP1 for MS SQL Server 2005 as a prerequisite before you will be able to upgrade your machine with the cumulative hotfix package (build 2153) for SQL Server 2005. SO it is a 2 steps process.

Regards,
Yitzhak

Friday, March 9, 2012

Error not flowing down Error Precedent Constraint path

I have a dataflow task which keeps erroring, at which point the flow should go down the red path to my error handling SQL Task.

But it is failing to do so.

anyone know why?

What type of transform are you using? (note: task is for control flow not data flow) Have you set up your error output to redirect rows on error? How about for truncation?

etc...

|||

Adolf,

could you explain bettter what is your problem?

You have in eventhandler a SQL task to save the inesperated error, true?

the error is in this SQL Task?

Regards!

|||This is occuring at the Control Flow level.

The design:
A data flow task has two paths coming out of it: 1 green, 1 red.
The green path continues on to another DF task, the red goes to an SQL task.

What happens:
The DF turns red but the flow does not then progress to the SQL task. It just stops.|||What I failed to mention was that the SQL task has 3 other failure paths joining it

I just set the precedence to "OR" instead of "AND" and it works.

Sunday, February 26, 2012

Error Message.....

I am using SQL 2K.
I am calling the below SQL statement as one of the SQL task in one of the
step.
EXEC SP_CYCLE_ERRORLOG
I am getting the attached message.
How to solve it?
Thanks,
Alok
Below is the error message.
"EXCUTE permission denied on object 'sp_cycle_errolog', database
'master',owner 'dbo'"
Alok Choudhary wrote:
> I am using SQL 2K.
> I am calling the below SQL statement as one of the SQL task in one of
> the step.
> EXEC SP_CYCLE_ERRORLOG
> I am getting the attached message.
> How to solve it?
> Thanks,
> Alok
> Below is the error message.
> "EXCUTE permission denied on object 'sp_cycle_errolog', database
> 'master',owner 'dbo'"
Your user id does not have rights to execute that procedure because you
are probably not a system administrator. Admin rights are required.
David Gugick
Imceda Software
www.imceda.com
|||What server roles are you a member of? sp_cycle_errorlog is sysadmin only.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Alok Choudhary" <AC_Ind@.hotmail.com> wrote in message
news:eCsUogNCFHA.1396@.TK2MSFTNGP14.phx.gbl...
> I am using SQL 2K.
> I am calling the below SQL statement as one of the SQL task in one of the
> step.
> EXEC SP_CYCLE_ERRORLOG
> I am getting the attached message.
> How to solve it?
> Thanks,
> Alok
> Below is the error message.
> "EXCUTE permission denied on object 'sp_cycle_errolog', database
> 'master',owner 'dbo'"
>
>

Error Message.....

I am using SQL 2K.
I am calling the below SQL statement as one of the SQL task in one of the
step.
EXEC SP_CYCLE_ERRORLOG
I am getting the attached message.
How to solve it?
Thanks,
Alok
Below is the error message.
"EXCUTE permission denied on object 'sp_cycle_errolog', database
'master',owner 'dbo'"Alok Choudhary wrote:
> I am using SQL 2K.
> I am calling the below SQL statement as one of the SQL task in one of
> the step.
> EXEC SP_CYCLE_ERRORLOG
> I am getting the attached message.
> How to solve it?
> Thanks,
> Alok
> Below is the error message.
> "EXCUTE permission denied on object 'sp_cycle_errolog', database
> 'master',owner 'dbo'"
Your user id does not have rights to execute that procedure because you
are probably not a system administrator. Admin rights are required.
David Gugick
Imceda Software
www.imceda.com|||What server roles are you a member of? sp_cycle_errorlog is sysadmin only.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Alok Choudhary" <AC_Ind@.hotmail.com> wrote in message
news:eCsUogNCFHA.1396@.TK2MSFTNGP14.phx.gbl...
> I am using SQL 2K.
> I am calling the below SQL statement as one of the SQL task in one of the
> step.
> EXEC SP_CYCLE_ERRORLOG
> I am getting the attached message.
> How to solve it?
> Thanks,
> Alok
> Below is the error message.
> "EXCUTE permission denied on object 'sp_cycle_errolog', database
> 'master',owner 'dbo'"
>
>

Error Message.....

I am using SQL 2K.
I am calling the below SQL statement as one of the SQL task in one of the
step.
EXEC SP_CYCLE_ERRORLOG
I am getting the attached message.
How to solve it?
Thanks,
Alok
Below is the error message.
"EXCUTE permission denied on object 'sp_cycle_errolog', database
'master',owner 'dbo'"Alok Choudhary wrote:
> I am using SQL 2K.
> I am calling the below SQL statement as one of the SQL task in one of
> the step.
> EXEC SP_CYCLE_ERRORLOG
> I am getting the attached message.
> How to solve it?
> Thanks,
> Alok
> Below is the error message.
> "EXCUTE permission denied on object 'sp_cycle_errolog', database
> 'master',owner 'dbo'"
Your user id does not have rights to execute that procedure because you
are probably not a system administrator. Admin rights are required.
--
David Gugick
Imceda Software
www.imceda.com|||What server roles are you a member of? sp_cycle_errorlog is sysadmin only.
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Alok Choudhary" <AC_Ind@.hotmail.com> wrote in message
news:eCsUogNCFHA.1396@.TK2MSFTNGP14.phx.gbl...
> I am using SQL 2K.
> I am calling the below SQL statement as one of the SQL task in one of the
> step.
> EXEC SP_CYCLE_ERRORLOG
> I am getting the attached message.
> How to solve it?
> Thanks,
> Alok
> Below is the error message.
> "EXCUTE permission denied on object 'sp_cycle_errolog', database
> 'master',owner 'dbo'"
>
>

Friday, February 17, 2012

error message 8152

When I am run a Stored Procedure -
dbo.sh_UploadPreTransfer task on SQL 7 and try to upload
PreTransfer tables, it showed a erroe message "String or
binary data would be truncated (message 8152)", could you
please give some advice? thanksIt means that your stored procedure is trying to insert more data than it
would fit into a character column. For example, you have a column called
TaskURL, which is of length char(128). But you try to insert a string of
length 200 characters, into this column, and you get this error.
It is bad that the error message will not show you which column is resulting
in the error.
You could use Profiler to trap the events SP:StmtStarting, and Error (with a
filter on Error for error number 8152), to see which statement is causing
the error.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm
"YanLing" <luo_yanling@.hotmail.com> wrote in message
news:02da01c3bcd7$e890a550$a001280a@.phx.gbl...
When I am run a Stored Procedure -
dbo.sh_UploadPreTransfer task on SQL 7 and try to upload
PreTransfer tables, it showed a erroe message "String or
binary data would be truncated (message 8152)", could you
please give some advice? thanks

Wednesday, February 15, 2012

Error Message

Hi all
My doubt is when we perform any task in case of any error we will get the message like this

Msg 2627, Level 14, State 1, Procedure rec_ins, Line 3
Violation of PRIMARY KEY constraint 'PK_emp'. Cannot insert duplicate key in object 'dbo.emp'.

I want to suppress the message generated by the database is it possible or not . In case of yes how to handle it

waiting for valuable reply

Baba

If you use sql server 2005 use the try..catch block.

Code Snippet

Begin Try

Insert Into YourTable Values(Yourvalues)

End Try

Begin Catch

End Catch

If you use sql server 2000 you can't suppress the message. You have to validate the data while inserting...

Code Snippet

Insert Into Yourtable

Select Yourvalues Where

Not Exists (Select 1 From YourTable With(Nolock) Where PrimaryKeyColumn=PrimaryKeyValue)

|||Thank u for u r reply