[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

a script that accepts user input

Posted on 2012-08-13
3
Medium Priority
?
201 Views
Last Modified: 2012-08-23
I need to use a function to return records for all classes with an enrollment of more than a particular number input by a specified user. As well as write a script that will accept a users input and invoke the function.

I am really unsure where I should start here!!
The columns in my table are like so
Course_ID
Ref_Number
Faculty_ID
Term
Enrollment
TotRev
0
Comment
Question by:jphilli
  • 2
3 Comments
 
LVL 22

Expert Comment

by:Nico Bontenbal
ID: 38290903
The function on SQL Server can be a 'stored procedure' with a parameter. It would look something like this:
Create procedure CourseWithEnrollment(@MinEnrollments as int)
as
select 
    Course_ID,
    Ref_Number,
    Faculty_ID,
    Term,
    Enrollment,
    TotRev
from 
    Course
where
    Enrollment >= @MinEnrollments

Open in new window


You can invoke this procedure like this:
exec CourseWithEnrollment 10

Open in new window


Not sure what you mean by 'a script that accepts user input'. You need some kind of client application for this. That could be Excel, MS Access, HTML, VBScript etc. So I need some more information to know what you need.
0
 

Accepted Solution

by:
jphilli earned 0 total points
ID: 38308451
CREATE FUNCTION fnCourseTerms
      (@enrollmentNum int =0)
      RETURNS TABLE
RETURN
      (SELECT * FROM Course
      WHERE Enrollment >= @enrollmentNum)
0
 

Author Closing Comment

by:jphilli
ID: 38324057
I figured out using other means.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question