Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2006-06-23 : 17:25:15
|
| Can;t I set the default something like this : @enddate datetime = getdate()? I keep getting an syntax error.... create proc usp_gettickets ( @startdate datetime = '20060101' , @enddate datetime = getdate() , @agent_id int = 1000, @priority_id int = 1000, @clinic_id int = 1000, @issuetype_id int = 1000) as SELECT Ticket_ID, Create_Date, CallbackInfo, c.Clinic_ID, Requestor, g.Status_name, e.priority, d.IssueType, b.Agent_Name, IssueDesc, f.RequestMethod_desc, Followup FROM Ticket_Header a join agents b on a.agent_id = b.agent_id Join clinics c on a.clinic_id = c.ID join issuetypes d on a.issuetype_id = d.issuetype_id join priorities e on e.priority_id = a.priority_id join requestmethods f on a.RequestMethod_ID = f.RequestMethod_ID join Statuses g on g.Status_ID = a.Status_ID where ( create_date between @startdate and @enddate ) and (@agent_id = 1000 or a.agent_id = @agent_id ) and (@priority_id = 1000 or a.priority_id = @priority_id ) and (@clinic_id = 1000 or a.clinit_id = @clinic_id ) and (@issuetype_id = 1000 or a.issuetype_id = @issuetype_id ) |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-06-23 : 17:58:17
|
| ...@enddate datetime = null...asif @enddate is nullselect @enddate = getdate()==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|