Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
nsqlserver
Starting Member
1 Post |
Posted - 2010-05-26 : 04:17:14
|
| Hi,I have pasted my 1st Stord Procedure , SP Caller and table schema.When inserting it inserts only the 1st Character for the Varchar column. Where I have went wrong ?It does the insertion in that way in the studio it is also giving a message , The commit transaction has no corresponding begin transacion where it has begin and end.SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Description: First SP-- =============================================CREATE PROCEDURE Add_catego -- Add the parameters for the stored procedure here @cat_id INT = 0, @cat_name varchar(50) = 'sss'ASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure hereBEGIN TRANSACTIONINSERT INTO dbo.category ( cat_id ,cat_name ) VALUES (@cat_id,@cat_name)COMMIT TRANSACTION ENDGO==============SP Caller==============================================USE Expences;GOEXECUTE Add_catego @cat_id = 300, @cat_name = 'argheim';GO===========Table schema===============================================CREATE TABLE [dbo].[category]( [cat_id] [int] NOT NULL, [cat_name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, CONSTRAINT [PK_category] PRIMARY KEY CLUSTERED ( [cat_id] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]NDU |
|
|
|
|
|