What i'm trying to do here is passing 2 employee name from two drop
down text box(doing a filtering with "From Employee" and "To
Employee"), and assign it to a global variable which i declared.
Is there something i miss out or i did worng which cause a error
"Incorrect syntax near the keyword 'BEGIN'. (.Net SqlClient Data
Provider)".
It would be so helpful of you if links of website or previous post or
any reference are provided, which give some basic tutorial on how to
create codes as shown below.
Thanks in advance
DECLARE @.G_StartEmp AS CHAR(10), @.G_EndEmp AS CHAR(10)
IF @.StartEmp > @.EndEmp
BEGIN
Set @.G_StartEmp = @.EndEmp
Set @.G_EndEmp = @.StartEmp
END
ELSE
BEGIN
Set @.G_StartEmp = @.StartEmp
Set @.G_EndEmp = @.EndEmp
END IF
BEGIN
select * from EMPLOYEE
where employeename between G_StartEmp and G_EndEmp
END
DId you wrap that code in a stored procedure ?
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de|||Hi, after spending some time again on this, i realize i added an extra "IF" , which is the cause of this error.
Thanks for taking your time to reply me Jens K. Suessmeyer.
DECLARE @.G_StartEmp AS CHAR(10), @.G_EndEmp AS CHAR(10)
IF @.StartEmp > @.EndEmp
BEGIN
Set @.G_StartEmp = @.EndEmp
Set @.G_EndEmp = @.StartEmp
END
ELSE
BEGIN
Set @.G_StartEmp = @.StartEmp
Set @.G_EndEmp = @.EndEmp
END (Originally was "END IF")
BEGIN
select * from EMPLOYEE
where employeename between G_StartEmp and G_EndEmp
END
No comments:
Post a Comment