Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Closed Points: 250 Time: 11:18 - Dec 30, 2008  

san

Issue with stored procedure

Hello,

I am trying to build database with tables, functions and stored procedures.
whenever I try to execute the stored procedure I have created its throwing me error.
I am using SQL Server 2005 database.
I was trying to insert data using the stored procedure (InsertProblemCreation) and function (GetTeamMemberID) I am not sure whether I am doing the right way or not

Here is the error
Msg 515, Level 16, State 2, Procedure InsertProblemCreation, Line 135
Cannot insert the value NULL into column 'TeamMemberId', table 'HelpDesk.dbo.ProblemStatus'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Msg 50000, Level 16, State 1, Procedure InsertProblemCreation, Line 175
Insert into ProblemStatus table Failed for Case -1000

If any one can help it will be greatly appreciated.

Thank you

############################################
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Users](
[UserId] [int] IDENTITY(1,1) NOT NULL,
[UserName] [nvarchar](100) NOT NULL,
[Email] [nvarchar](120) NOT NULL,
[Location] [nvarchar](120) NOT NULL,
[Phone] [nvarchar](20) NOT NULL,
[SSN] [nvarchar](11) NOT NULL,
[NH] [nvarchar](20) NOT NULL,
CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED
(
[UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_Users_Email] ON [dbo].[Users]
(
[Email] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_Users_SSN] ON [dbo].[Users]
(
[SSN] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Departments] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Departments](
[DepartmentId] [int] IDENTITY(1,1) NOT NULL,
[DepartmentName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_Departments] PRIMARY KEY CLUSTERED
(
[DepartmentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Representatives] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Representatives](
[RepresentativeId] [int] IDENTITY(1,1) NOT NULL,
[RepresentativeSSN] [nvarchar](11) NOT NULL,
[RepresentativeZipCode] [nvarchar](10) NOT NULL,
[OrganizationName] [nvarchar](100) NOT NULL,
CONSTRAINT [PK_Representatives] PRIMARY KEY CLUSTERED
(
[RepresentativeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_Representatives_RepresentativeSSN] ON [dbo].[Representatives]
(
[RepresentativeSSN] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Problems] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Problems](
[ProblemId] [int] IDENTITY(1,1) NOT NULL,
[IsProblemQuestion] [bit] NOT NULL,
[IsComment] [bit] NOT NULL,
[ProblemTitle] [nvarchar](255) NOT NULL,
[ProblemDescription] [nvarchar](2000) NOT NULL,
[Attachment] [nvarchar](1000) NULL,
CONSTRAINT [PK_Problems] PRIMARY KEY CLUSTERED
(
[ProblemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[ProblemStatus] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProblemStatus](
[ProblemStatusId] [int] IDENTITY(1,1) NOT NULL,
[ProblemsUsersDeptsRepsId] [int] NOT NULL,
[TeamMemberId] [int] NOT NULL,
[ProblemStatus] [nvarchar](10) NOT NULL,
CONSTRAINT [PK_ProblemStatus] PRIMARY KEY CLUSTERED
(
[ProblemStatusId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_ProblemStatus_ProblemsUsersDeptsRepsId] ON [dbo].[ProblemStatus]
(
[ProblemsUsersDeptsRepsId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_ProblemStatus_TeamMemberId] ON [dbo].[ProblemStatus]
(
[TeamMemberId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Table [dbo].[ProblemsUsersDeptsReps] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProblemsUsersDeptsReps](
[ProblemsUsersDeptsRepsId] [int] IDENTITY(1,1) NOT NULL,
[ProblemId] [int] NOT NULL,
[UserId] [int] NOT NULL,
[DepartmentId] [int] NOT NULL,
[IsRepresentativeInvolved] [bit] NOT NULL,
[RepresentativeId] [int] NULL,
CONSTRAINT [PK_ProblemsUsersDeptsReps] PRIMARY KEY CLUSTERED
(
[ProblemsUsersDeptsRepsId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_ProblemsUsersDeptsReps_ProblemId] ON [dbo].[ProblemsUsersDeptsReps]
(
[ProblemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Table [dbo].[TeamMembers] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TeamMembers](
[TeamMemberId] [int] IDENTITY(1,1) NOT NULL,
[TeamMemberName] [nvarchar](100) NOT NULL,
[TeamMemberEmail] [nvarchar](120) NOT NULL,
[DepartmentId] [int] NOT NULL,
CONSTRAINT [PK_TeamMembers] PRIMARY KEY CLUSTERED
(
[TeamMemberId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_TeamMembers_TeamMemberEmail] ON [dbo].[TeamMembers]
(
[TeamMemberEmail] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: UserDefinedFunction [dbo].[GetTeamMemberId] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE function [dbo].[GetTeamMemberId]
(@problemsUsersDeptsRepsId int,
@departmentId int
)
returns int
as

begin
Declare @teamMemberId int,
@maxTeamMemberId int,
@minTeamMemberId int,
@maxProblemstatusId int


Select @maxTeamMemberId = max(TeamMemberId)
from TeamMembers
where DepartmentId = @departmentId

Select @minTeamMemberId = min(TeamMemberId)
from TeamMembers
where DepartmentId = @departmentId

If exists (Select top 1 1 From Problemstatus a
join TeamMembers b
on a.TeamMemberId = b.TeamMemberId
Where a.ProblemstatusId < @problemsUsersDeptsRepsId
And b.DepartmentId = @departmentId
)
Begin
Select @maxProblemstatusId = Max(ProblemstatusId)
From Problemstatus a
join TeamMembers b
on a.TeamMemberId = b.TeamMemberId
Where a.ProblemstatusId < @problemsUsersDeptsRepsId
And b.DepartmentId = @departmentId

End
Else
Begin
Select @teamMemberId = -1000
return @teamMemberId
End

Select @teamMemberId = TeamMemberId
From Problemstatus
Where ProblemstatusId = @maxProblemstatusId

If (@teamMemberId = @maxTeamMemberId)
Begin
Select @teamMemberId = TeamMemberId
From TeamMembers
Where TeamMemberId = @minTeamMemberId
End
Else
Begin
Select @teamMemberId = TeamMemberId
From TeamMembers
Where TeamMemberId = @teamMemberId + 1
End



return @teamMemberId

End
GO
/****** Object: StoredProcedure [dbo].[InsertProblemCreationByTeamMember] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Proc [dbo].[InsertProblemCreationByTeamMember]
(
@teamMemberEmail nvarchar(100),
@userName nvarchar(100),
@email nvarchar(120),
@location nvarchar(120),
@phone nvarchar(20),
@SSN nvarchar(11),
@NH nvarchar(10),
@attachment nvarchar(1000),
@departmentname nvarchar(50),
@representativeSSN nvarchar(11),
@representativeZipCode nvarchar(10),
@organizationName nvarchar(100),
@isProblemQuestion bit,
@isComment bit,
@problemTitle nvarchar(255),
@problemDescription nvarchar(2000)
)
As

Declare @userId int,
@representativeId int,
@departmentId int,
@problemId int,
@problemsUsersDeptsRepsId int,
@teamMemberId int,
@problemStatusId int,
@errorMsg nvarchar(128)


Begin Transaction


If exists(Select top 1 1 from Users where email = @email)
begin
Select @userId = UserId From Users where email = @email
End
Else
begin
Insert into Users
(UserName,Email,Location,Phone,SSN,NH)
Select @userName,@email,@location,@phone,@SSN,@NH

If @@error <> 0
Begin
select @errorMsg = 'Insert into Users table Failed'
Goto ERROREXIT

End

Select @userId = @@identity
End


If exists(Select top 1 1 from Departments where DepartmentName = @departmentName)
begin
Select @departmentId = DepartmentId From Departments where DepartmentName = @departmentName
End
Else
begin
Insert into Departments
(DepartmentName)
Select @departmentName

If @@error <> 0
Begin
select @errorMsg = 'Insert into Departments table Failed'
Goto ERROREXIT

End

Select @departmentId = @@identity
End

If (@representativeSSN is not null)
begin
If exists(Select top 1 1 from Representatives where RepresentativeSSN = @representativeSSN)
begin
Select @representativeId = RepresentativeId From Representatives where RepresentativeSSN = @representativeSSN
End
Else
begin
Insert into Representatives
(RepresentativeSSN,RepresentativeZipCode,OrganizationName)
Select @representativeSSN,@representativeZipCode,@organizationName

If @@error <> 0
Begin
select @errorMsg = 'Insert into Representatives table Failed'
Goto ERROREXIT
End

Select @representativeId = @@identity
End
End


Insert into Problems
(IsProblemQuestion,IsComment,ProblemTitle,ProblemDescription,Attachment)
Select @isProblemQuestion, @isComment, @problemTitle, @problemDescription,@attachment

If @@error <> 0
Begin
select @errorMsg = 'Insert into Problems table Failed'
Goto ERROREXIT
End

Select @problemId = @@identity


Insert into ProblemsUsersDeptsReps
(ProblemId,UserId,DepartmentId,IsRepresentativeInvolved,RepresentativeId)
Select @problemId,@userId,@departmentId,Case when @representativeId is null then 0 else 1 end,@representativeId


If @@error <> 0
Begin
select @errorMsg = 'Insert into ProblemsUsersDeptsReps table Failed'
Goto ERROREXIT
End

Select @problemsUsersDeptsRepsId = @@identity


Select @teamMemberId = TeamMemberId
From TeamMembers
Where TeamMemberEmail = @teamMemberEmail

If @teamMemberId is not null
Begin
Insert into ProblemStatus
(ProblemsUsersDeptsRepsId,TeamMemberId, ProblemStatus)
Select @problemsUsersDeptsRepsId,@teamMemberId, 'OPEN'

If @@error <> 0
Begin
select @errorMsg = 'Insert into ProblemStatus table Failed'
Goto ERROREXIT
End

Select @problemStatusId = @@identity

End
Else
Begin
select @errorMsg = 'Error getting TeamMemberId'
Goto ERROREXIT

End


Goto OKEXIT

ERROREXIT:

raiserror( @errorMsg, 16 , 1 )

if @@TRANCOUNT > 1
BEGIN
COMMIT TRANSACTION
END
Else if @@TRANCOUNT = 1
BEGIN
ROLLBACK TRANSACTION
END

RETURN ( -1 )


OKEXIT:

If @@TRANCOUNT > 0
BEGIN
COMMIT TRANSACTION
END
RETURN ( 0 )
GO
/****** Object: StoredProcedure [dbo].[InsertProblemCreation] Script Date: 12/24/2008 17:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Proc [dbo].[InsertProblemCreation]
(
@userName nvarchar(100),
@email nvarchar(120),
@location nvarchar(120),
@phone nvarchar(20),
@SSN nvarchar(11),
@NH nvarchar(10),
@departmentname nvarchar(50),
@representativeSSN nvarchar(11),
@representativeZipCode nvarchar(10),
@organizationName nvarchar(100),
@isProblemQuestion bit,
@isComment bit,
@problemTitle nvarchar(255),
@problemDescription nvarchar(2000)
)
As


Declare @userId int,
@representativeId int,
@departmentId int,
@problemId int,
@problemsUsersDeptsRepsId int,
@teamMemberId int,
@problemStatusId int,
@errorMsg nvarchar(128)


Begin Transaction


If exists(Select top 1 1 from Users where email = @email)
begin
Select @userId = UserId From Users where email = @email
End
Else
begin
Insert into Users
(UserName,Email,Location,Phone,SSN,NH)
Select @userName,@email,@location,@phone,@SSN,@NH

If @@error <> 0
Begin
select @errorMsg = 'Insert into Users table Failed'
Goto ERROREXIT

End

Select @userId = @@identity
End




If exists(Select top 1 1 from Departments where DepartmentName = @departmentName)
begin
Select @departmentId = DepartmentId From Departments where DepartmentName = @departmentName
End
Else
begin
Insert into Departments
(DepartmentName)
Select @departmentName

If @@error <> 0
Begin
select @errorMsg = 'Insert into Departments table Failed'
Goto ERROREXIT

End

Select @departmentId = @@identity
End

If (@representativeSSN is not null)
begin
If exists(Select top 1 1 from Representatives where RepresentativeSSN = @representativeSSN)
begin
Select @representativeId = RepresentativeId From Representatives where RepresentativeSSN = @representativeSSN
End
Else
begin
Insert into Representatives
(RepresentativeSSN,RepresentativeZipCode,OrganizationName)
Select @representativeSSN,@representativeZipCode,@organizationName

If @@error <> 0
Begin
select @errorMsg = 'Insert into Representatives table Failed'
Goto ERROREXIT
End

Select @representativeId = @@identity
End
End


Insert into Problems
(IsProblemQuestion,IsComment,ProblemTitle,ProblemDescription)
Select @isProblemQuestion, @isComment, @problemTitle, @problemDescription

If @@error <> 0
Begin
select @errorMsg = 'Insert into Problems table Failed'
Goto ERROREXIT
End

Select @problemId = @@identity


Insert into ProblemsUsersDeptsReps
(ProblemId,UserId,DepartmentId,IsRepresentativeInvolved,RepresentativeId)
Select @problemId,@userId,@departmentId,Case when @representativeId is null then 0 else 1 end,@representativeId


If @@error <> 0
Begin
select @errorMsg = 'Insert into ProblemsUsersDeptsReps table Failed'
Goto ERROREXIT
End

Select @problemsUsersDeptsRepsId = @@identity


Select @teamMemberId = dbo.GetTeamMemberId(@problemsUsersDeptsRepsId,@departmentId)

If @teamMemberId = -1000
Begin
Select @teamMemberId = min(TeamMemberId)
From TeamMembers
Where DepartmentId = @departmentId

Insert into ProblemStatus
(ProblemsUsersDeptsRepsId,TeamMemberId,ProblemStatus)
Select @problemsUsersDeptsRepsId,@teamMemberId,'OPEN'

If @@error <> 0
Begin
select @errorMsg = 'Insert into ProblemStatus table Failed for Case -1000'
Goto ERROREXIT
End

Select @problemStatusId = @@identity

End
Else If Exists( Select top 1 1 From TeamMembers Where TeamMemberId = @teamMemberId)
Begin
Insert into ProblemStatus
(ProblemsUsersDeptsRepsId,TeamMemberId, ProblemStatus)
Select @problemsUsersDeptsRepsId,@teamMemberId, 'OPEN'

If @@error <> 0
Begin
select @errorMsg = 'Insert into ProblemStatus table Failed'
Goto ERROREXIT
End

Select @problemStatusId = @@identity

End
Else
Begin
select @errorMsg = 'Error getting TeamMemberId from GetTeamMemberId'
Goto ERROREXIT

End


Goto OKEXIT

ERROREXIT:

raiserror( @errorMsg, 16 , 1 )

if @@TRANCOUNT > 1
BEGIN
COMMIT TRANSACTION
END
Else if @@TRANCOUNT = 1
BEGIN
ROLLBACK TRANSACTION
END

RETURN ( -1 )


OKEXIT:

If @@TRANCOUNT > 0
BEGIN
COMMIT TRANSACTION
END
RETURN ( 0 )
GO
/****** Object: ForeignKey [FK_ProblemsUsersDeptsReps_ProblemStatus] Script Date: 12/24/2008 17:47:10 ******/
ALTER TABLE [dbo].[ProblemStatus] WITH CHECK ADD CONSTRAINT [FK_ProblemsUsersDeptsReps_ProblemStatus] FOREIGN KEY([ProblemsUsersDeptsRepsId])
REFERENCES [dbo].[ProblemsUsersDeptsReps] ([ProblemsUsersDeptsRepsId])
GO
ALTER TABLE [dbo].[ProblemStatus] CHECK CONSTRAINT [FK_ProblemsUsersDeptsReps_ProblemStatus]
GO
/****** Object: ForeignKey [FK_TeamMembers_ProblemStatus] Script Date: 12/24/2008 17:47:10 ******/
ALTER TABLE [dbo].[ProblemStatus] WITH CHECK ADD CONSTRAINT [FK_TeamMembers_ProblemStatus] FOREIGN KEY([TeamMemberId])
REFERENCES [dbo].[TeamMembers] ([TeamMemberId])
GO
ALTER TABLE [dbo].[ProblemStatus] CHECK CONSTRAINT [FK_TeamMembers_ProblemStatus]
GO
/****** Object: ForeignKey [FK_Problems_ProblemsUserDeptsReps] Script Date: 12/24/2008 17:47:10 ******/
ALTER TABLE [dbo].[ProblemsUsersDeptsReps] WITH CHECK ADD CONSTRAINT [FK_Problems_ProblemsUserDeptsReps] FOREIGN KEY([ProblemId])
REFERENCES [dbo].[Problems] ([ProblemId])
GO
ALTER TABLE [dbo].[ProblemsUsersDeptsReps] CHECK CONSTRAINT [FK_Problems_ProblemsUserDeptsReps]
GO
/****** Object: ForeignKey [FK_Representatives_ProblemsUsersDeptsReps] Script Date: 12/24/2008 17:47:10 ******/
ALTER TABLE [dbo].[ProblemsUsersDeptsReps] WITH CHECK ADD CONSTRAINT [FK_Representatives_ProblemsUsersDeptsReps] FOREIGN KEY([RepresentativeId])
REFERENCES [dbo].[Representatives] ([RepresentativeId])
GO
ALTER TABLE [dbo].[ProblemsUsersDeptsReps] CHECK CONSTRAINT [FK_Representatives_ProblemsUsersDeptsReps]
GO
/****** Object: ForeignKey [FK_Users_ProblemsUsersDeptsReps] Script Date: 12/24/2008 17:47:10 ******/
ALTER TABLE [dbo].[ProblemsUsersDeptsReps] WITH CHECK ADD CONSTRAINT [FK_Users_ProblemsUsersDeptsReps] FOREIGN KEY([UserId])
REFERENCES [dbo].[Users] ([UserId])
GO
ALTER TABLE [dbo].[ProblemsUsersDeptsReps] CHECK CONSTRAINT [FK_Users_ProblemsUsersDeptsReps]
GO
/****** Object: ForeignKey [FK_Departments_TeamMembers] Script Date: 12/24/2008 17:47:10 ******/
ALTER TABLE [dbo].[TeamMembers] WITH CHECK ADD CONSTRAINT [FK_Departments_TeamMembers] FOREIGN KEY([DepartmentId])
REFERENCES [dbo].[Departments] ([DepartmentId])
GO
ALTER TABLE [dbo].[TeamMembers] CHECK CONSTRAINT [FK_Departments_TeamMembers]
GO

Categories

Answer Discussion
Tutorials

 

san

Date:: Dec 30, 2008

Time:: 12:01

Can somebody help me regarding this issue, its pretty urgent....

Thanks
SAN

san

Date:: Jan 07, 2009

Time:: 14:30

able to resolve the issue myself

Question Answered

This question has been closed, and points have been rewarded to the following experts:


san: 250

You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

No tutorials have been submitted yet. Want to be the first?

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10354

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es