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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 store procedure urgent

Author  Topic 

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-10-31 : 02:43:39
Hi,everyone

I am in new in sql, i need storeprocedure query method when i enter front end value ,if error code is 1 then insert values into the datebases , i need store procedure correction of my query pls help..


i need to validation in sql

coding has given below


USE [IndusInd]
GO
/****** Object: StoredProcedure [dbo].[USP_Application_GetFinacleValidDetails] Script Date: 10/31/2013 11:14:29 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

alter procedure [dbo].[USP_Insert_Finance](@Finacleid int,@ChequeNo int,
@ChequeAmount float,
@BranchCode varchar(25),
@ValueDate date,
@ApplicationNo int,
@MatchFound bit,
@CreatedBy varchar(50),
@createdDate date)

AS

BEGIN

INSERT INTO [dbo].[mtblFinacleDetails]
(
ChequeAmount,
BranchCode,
ValueDate,
ApplicationNo,
MatchFound,
CreatedBy,
createdDate
)

SELECT ChequeAmount,BranchCode,ValueDate,ApplicationNo,MatchFound,CreatedBy,CreatedDate
from [dbo].[mtblFinacleDetails] as det inner join mtblFinacleDetailsTemp as tem
on det.finacleid = tem.finacleid WHERE ErrorCode = 1

END

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-31 : 02:45:52
the query looks fine. didnt understand issue you faced
are you getting some error? if yes, post error message you got

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-10-31 : 02:48:26
Msg 207, Level 16, State 1, Procedure USP_Insert_Finance, Line 28
Invalid column name 'ErrorCode'.
Msg 209, Level 16, State 1, Procedure USP_Insert_Finance, Line 26
Ambiguous column name 'ChequeAmount'.
Msg 209, Level 16, State 1, Procedure USP_Insert_Finance, Line 26
Ambiguous column name 'BranchCode'.
Msg 209, Level 16, State 1, Procedure USP_Insert_Finance, Line 26
Ambiguous column name 'ValueDate'.
Msg 209, Level 16, State 1, Procedure USP_Insert_Finance, Line 26
Ambiguous column name 'CreatedBy'.
Msg 209, Level 16, State 1, Procedure USP_Insert_Finance, Line 26
Ambiguous column name 'CreatedDate'.
Go to Top of Page

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-10-31 : 02:52:15
murukes sir,
the logic is when data insert into the table from frontend , the data are matching error code is 1 then data insert into the main table,

i want to write storeprocedure in this issue but i wrote storeprocedure is correct or not i not aware .i need help. pls
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2013-10-31 : 02:55:15
The errors are easy to understand. Use table qualifier for each column

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-10-31 : 02:57:43
how to use table qualifier sir
Go to Top of Page

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-10-31 : 02:59:18
vanakam madhivanan sir,

the logic is when data insert into the table from frontend , the data are matching error code is 1 then data insert into the main table,

i want to write storeprocedure in this issue but i wrote storeprocedure is correct or not i not aware .i need help. pls

pls correct my error i am new in sql .
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2013-10-31 : 03:02:41
Instead of ChequeAmount use tem.ChequeAmount, etc. Is there a column for error code?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-10-31 : 03:05:28
nandri Madhivanan sir,

i will try , keep on touch for help.
Go to Top of Page

lilianjie
Starting Member

3 Posts

Posted - 2013-10-31 : 03:43:10
unspammed
Go to Top of Page
   

- Advertisement -