Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompting a user for a date

Status
Not open for further replies.

vz

MIS
Joined
Jul 31, 2001
Messages
131
Location
US
Hi,
I am new to sql and I am tying to create a query that will prompt a user for a date, and I can't figure out how to do this, does anyone know?
Thanks
 
SQL Server does not include an end user interface. If you want to do things like prompt users, you will have to build one using VB, Access, a Web Page etc.
 
Actually I am trying to do it in VB and I have no idea how to write the sql code everytime I try I keep getting errors and i was hoping someone on this forum would know the sql. If anyone could help that would be great.
Thanks
 
If you would show the code that is being sent to the server and the error we could probably help you. If you are looking for a tutorial on how to work with SQL Server and VB I reccomend 'Beginning VB6 Database Programming' from WROX press. You can't miss it in a book store bright RED cover.

Someone else may be able to point you at a FAQ.
 
I would suggest creating a stored procedure and then execute that procedure from your coded. Here's an example that prompts the user for various criteria:

CREATE PROCEDURE SearchALL @ENTER_FIRSTNAME NVARCHAR (12), @ENTER_LASTNAME NVARCHAR (12), @ENTER_SSN NVARCHAR(9),
@ENTER_DOD_MMDDYYYY NVARCHAR (8), @ENTER_DOB_MMDDYYYY NVARCHAR (8), @ENTER_STATE NVARCHAR (2)
AS
SELECT MASTER_DEATH_FILE.DELTA,MASTER_DEATH_FILE.SSN, MASTER_DEATH_FILE.LASTNAME, MASTER_DEATH_FILE.FIRSTNAME, MASTER_DEATH_FILE.DOD, MASTER_DEATH_FILE.DOB,
MASTER_DEATH_FILE.ST
FROM MASTER_DEATH_FILE (INDEX(IND_SSN)NOLOCK)
WHERE MASTER_DEATH_FILE.FIRSTNAME Like @ENTER_FIRSTNAME AND MASTER_DEATH_FILE.LASTNAME Like @ENTER_LASTNAME
AND MASTER_DEATH_FILE.SSN LIKE @ENTER_SSN
AND MASTER_DEATH_FILE.DOD LIKE @ENTER_DOD_MMDDYYYY
AND MASTER_DEATH_FILE.DOB LIKE @ENTER_DOB_MMDDYYYY
AND MASTER_DEATH_FILE.ST LIKE @ENTER_STATE

GO Ashley L Rickards
SQL DBA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top