SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 store procedure urgent
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rajnidas
Yak Posting Veteran

India
65 Posts

Posted - 10/31/2013 :  02:43:39  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 10/31/2013 :  02:45:52  Show Profile  Reply with Quote
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

India
65 Posts

Posted - 10/31/2013 :  02:48:26  Show Profile  Reply with Quote
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

India
65 Posts

Posted - 10/31/2013 :  02:52:15  Show Profile  Reply with Quote
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

India
22744 Posts

Posted - 10/31/2013 :  02:55:15  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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

India
65 Posts

Posted - 10/31/2013 :  02:57:43  Show Profile  Reply with Quote
how to use table qualifier sir
Go to Top of Page

rajnidas
Yak Posting Veteran

India
65 Posts

Posted - 10/31/2013 :  02:59:18  Show Profile  Reply with Quote
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

India
22744 Posts

Posted - 10/31/2013 :  03:02:41  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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

India
65 Posts

Posted - 10/31/2013 :  03:05:28  Show Profile  Reply with Quote
nandri Madhivanan sir,

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

lilianjie
Starting Member

USA
3 Posts

Posted - 10/31/2013 :  03:43:10  Show Profile  Reply with Quote
unspammed
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000