Inserting Values In sql Table Based on Master Table [Resolved]

Posted by Self-Innovator under Sql Server on 3/30/2012 | Points: 10 | Views : 1170 | Status : [Member] | Replies : 1
Hi friends....
I've an issue in My SQL Sp while Insert

I wanted to store the values in My table Users where i am passing DesigCode from frontEnd to table tblUsers. The DesigCode should only get Inserted only If i have tat DesigCode in My Master Table tbGroupMst here i've DesigCode columns.
My Master Table
DesigCode
========
ACM
ACS
ADA
BMD

User Master table
UserId
Name
DesigCode

Pls help me in My insert Sp how to go ahead wit this...I've tried the SP which i couldn't proceed further chek it...
CREATE PROC spInsertUserDetails
@Uid CHAR(4),
@Name VARCHAR(70),
@DesigCode CHAR(3),

AS
BEGIN
DECLARE @ChkDesigCode CHAR(3)
DECLARE @Len INT
SET @Len=(SELECT Count(GroupCode) FROM dbo.tblGroupPrivMst)
WHILE @Len>0
BEGIN
SET @ChkDesigCode=(SELECT
END
INSERT INTO tblUserMst Values(@Uid,@Pwd,@Name,@DesigCode,@Email,@TelNo,@HandPhNo,@active)
END


Join Hands Change lives
Thanks & Regards
Straight Edge Society



Responses

Posted by: Self-Innovator on: 3/30/2012 [Member] Bronze | Points: 25

Up
0
Down

Resolved
.

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response