2
Answers

sql stored procedure for insert


Hi,
Iam creating stored procedure for insert statement but it is giving error that
must declare scalar varialbe empno (i am not understanding) please help me onthis
create
procedure proc
(

@empno
varchar(50) not null,
@leaveappdate
varchar(50) not null,
@leavetype
varchar(50) not null,
@balance
varchar(50) not null,
@fromdate
varchar(50) not null,
@todate
varchar(50) not null,
@fromduration
varchar(50) not null,
@toduration
varchar(50) not null,
@noofdays
varchar(50) not null,
@sanctionauthority
varchar(50) not null
)

as
insert
into CasualRestrictedLeaves values(@empno ,@leaveappdate ,@leavetype varchar(50),@balance ,@fromdate ,@todate ,@fromduration ,@toduration ,@noofdays ,@sanctionauthority );
Answers (2)
0
Andrew Fenster

Andrew Fenster

NA 2.2k 1.5m 14y


That's not hard to do.   You can open your current solution and add a new project.  The project type should be "class library."  In this project you put whatever classes you want.  The classes and methods you want to be accessible should be marked public.  The classes and methods you don't want other projects to access should be marked private or internal. 
 
My suggestion is that you make a class with a name like XmlUtilities.  This class should have a series of public static methods to parse XML. 
In your other projects / web applications / batch jobs that need to call your XmlUtilties, you right click on the project name in the solution explorer and add a reference to your new class library.

Your class library will compile into a .dll.  Your other projects, once you add a reference, will make a copy of the .dll and put it in their bin folder.  So each project / website / etc. will have a copy of the .dll.  Normally that would be fine.  If you are really worried about having multiple copies of the .dll, you can copy the .dll into the GAC (Global Access Cache) and then have all your other projects add a reference to that copy.  That's a much more involved effort, and it sounds like overkill for your project.

Good luck.