Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query Error
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Query Error
Miscellaneous
Thread ID:
01375273
Message ID:
01375273
Views:
50
I'm trying to create this proc:
--DROP PROC sp_GetCustomers

GO

CREATE PROCEDURE sp_GetCustomers
	@RecordId		INT = NULL,
	@FirstName		VARCHAR(30) = NULL,
	@LastName		VARCHAR(30) =NULL,
	@CreditLimit	MONEY = NULL,
	@State			VARCHAR(2) = NULL,
	@Active			BIT = NULL
	 
AS

	SELECT * 
		FROM Students
		WHERE ((@RecordId IS NULL) OR (RecordId = @RecordId)) AND 
			  ((@FirstName IS NULL) OR (FirstName = @FirstName)) AND 
			  ((@LastName IS NULL) OR (LastName = @LastName)) AND 
			  ((@CreditLimit IS NULL) OR (CreditLimit = @CreditLimit)) AND 
			  ((@State IS NULL) OR (State = @State)) AND 
			  ((@Active IS NULL) OR (Active = @Active)) 
I'm getting
Msg 207, Level 16, State 1, Procedure sp_GetCustomers, Line 17
Invalid column name 'CreditLimit'.
Msg 207, Level 16, State 1, Procedure sp_GetCustomers, Line 18
Invalid column name 'State'.
Msg 207, Level 16, State 1, Procedure sp_GetCustomers, Line 19
Invalid column name 'Active'.
The column names are correct.

Anyone?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform