Hi,
i had created the stored procedure as per the following link.
http://orionseven.com/blog/2009/09/30/using-table-valued-parameters-in-sql-server-2008-and-c/
http://www.codeproject.com/KB/database/sqlserver2008.aspx
Stored Procedure:
CREATE PROCEDURE [dbo].[uspPersonBulkInsert]
@tbPersonType tbPersonType READONLY
AS
BEGIN
INSERT INTO tbPerson(FirstName,MiddleName,LastName,PersonType)
SELECT FirstName,MiddleName,LastName,PersonType FROM @tbPersonType
END
USERDEFINED TABLE TYPE:
CREATE TYPE [dbo].[tbPersonType] AS TABLE(
[FirstName] [varchar](50) NULL,
[MiddleName] [varchar](50) NULL,
[LastName] [varchar](50) NULL,
[ModifiedDate] [datetime] NULL,
[PersonType] [varchar](3) NULL
)
GO
If i try to drag the custom stored procedure is Model.IsModel . i am getting the follwing error.
Exception while processing Server Explorer drag: System.Data.SqlClient.SqlException: Operand type clash: nvarchar is incompatible with tbPersonType
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at Mindscape.LightSpeed.Generator.Extraction.SqlServerExtractorBase.<ExtractProcedures>d__d.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Mindscape.LightSpeed.Generator.Extraction.Provider`1.ExtractProcedures(IEnumerable`1 procedureNames)
at Mindscape.LightSpeed.Generator.Integration.ProcedureBuilder.AddProceduresToModel(Model model, ILightSpeedDataSource connection, IEnumerable`1 procedureNames, IGenerationLog log)
at Mindscape.LightSpeed.Generator.Integration.DiagramDragDropHandler.<>c__DisplayClass4.<OnDragDrop>b__3(DragObject dragObject, IGenerationLog log)
at Mindscape.LightSpeed.Generator.Integration.ServerExplorer.IfIsServerExplorerDrag(DragEventArgs e, DragAction action)
Is there any other approach for this? If Yes, Can u provide the sample application for this.
Thanks and Regards,
Upendran P.V.