473,385 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Double Insert Statement Probs

Expand|Select|Wrap|Line Numbers
  1. ALTER PROCEDURE [dbo].[get_user]
  2. (    
  3.     @user_id varchar(8),
  4.     @pwd varchar(12)
  5.     )
  6. AS
  7.  
  8. IF EXISTS(SELECT Personel_No From TblUser_ID where Personel_No = @user_id)
  9.   BEGIN
  10.   IF EXISTS(SELECT Password From TblUser_ID where Personel_No = @user_id AND Password = @pwd)
  11.            BEGIN
  12. INSERT INTO TblAudit_Trails(Personel_No,IC_Baru,Business_Area) 
  13. SELECT Personel_No,IC_Baru,Business_Area 
  14. From TblPeribadi 
  15. WHERE Personel_No = @user_id AND IC_Baru = @pwd
  16. RETURN(3)
  17.            END
  18.   ELSE
  19.            RETURN(1)
  20.   END
  21. ELSE
  22.   BEGIN
  23.   IF EXISTS(SELECT Personel_No From TblPeribadi where Personel_No = @user_id)
  24.     BEGIN
  25.     IF EXISTS(SELECT IC_Baru From TblPeribadi where Personel_No = @user_id AND IC_Baru = @pwd)
  26.         BEGIN
  27.         INSERT INTO TblAudit_Trails(Personel_No,IC_Baru,Business_Area) 
  28.         SELECT Personel_No,IC_Baru,Business_Area 
  29.                     From TblPeribadi 
  30.         WHERE Personel_No = @user_id AND IC_Baru = @pwd
  31.  
  32.                     INSERT INTO TblUser_ID(Personel_No,Password,Update_By) 
  33.         VALUES(@user_id,@pwd,@user_id)
  34.         RETURN(4)
  35.                                 END
  36.     ELSE
  37.         RETURN(2)
  38.     END
  39.   ELSE
  40.                 RETURN(0)
  41. END
  42.  
//Msg 207, Level 16, State 1, Procedure get_user, Line 15
Invalid column name 'Personel_No'.
Msg 207, Level 16, State 1, Procedure get_user, Line 30
Invalid column name 'Personel_No'.

It appears as my thought cannot be double INSERT statement.but some example of SQL statement that I search for make it successful
So someone please help me..........
Sep 24 '08 #1
3 1609
acoder
16,027 Expert Mod 8TB
Moved to the SQL Server forum (I'm guessing slightly - might belong to Oracle). If it's the wrong forum, could a moderator kindly move it to the correct forum.

@OP, please post your questions in the correct forum. This does not belong in the Feedback forum.

Moderator.
Sep 24 '08 #2
iburyak
1,017 Expert 512MB
Check if TblUser_ID has a column Personel_No

It is hard to tell because I don't see your database objects.

Comment out pieces of your code and run it to find which one is having a problem.

Good Luck.
Sep 24 '08 #3
Check if TblUser_ID has a column Personel_No

It is hard to tell because I don't see your database objects.

Comment out pieces of your code and run it to find which one is having a problem.

Good Luck.
Exactly you're right! I have check it it's my database field name probs.....
Anyway sorry to burst into wrong forum place
Sep 25 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
2
by: Richard van Denzel | last post by:
Hi All, I've defined a table (m) with an double field (bedrag) in it and when I execute the next statement: INSERT INTO m (bedrag) VALUES('-7000,00'); the value get stored correctly. ...
2
by: Colin Hale | last post by:
This is driving me bananas. Can't find any info on this anywhere.... SQL 2000 seems to replace double space with a single space when I set a varchar field to " " (2spaces), it only stores " "...
7
by: John Bailo | last post by:
I'm seeing some odd locking behavior when using an DB2400 database and running an ado.net transaction. My code -- in simplified form, appears at the bottom. I want to run several INSERT...
0
by: alederer | last post by:
Hallo! I have a problem using SQLBindParameter for columns of datatype DOUBLE or REAL. e.g. I have an insert statement where i wan't to insert the value 100.10 into a DOUBLE column. For the...
0
by: John Bailo | last post by:
I'm seeing some odd locking behavior when using an DB2400 database and running an ado.net transaction. My code -- in simplified form, appears at the bottom. I want to run several INSERT...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
2
by: Darryl A. J. Staflund | last post by:
Hi there, Can anyone tell me why invoking a single SQL insert statement (well, rather, a method that performs a SQL insert) using an asynchronous delegate should result in twice the number of...
14
by: Chris Ochs | last post by:
The documentation doesn't have any examples of using an sql language function to do an insert, andI am at loss as to I am doing wrong here. The error I get trying to create the function is: ERROR:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.