Click here to Skip to main content
15,922,512 members
Home / Discussions / Database
   

Database

 
GeneralRe: MySQL Pin
loyal ginger25-Jan-10 5:02
loyal ginger25-Jan-10 5:02 
GeneralRe: MySQL Pin
dybs25-Jan-10 15:11
dybs25-Jan-10 15:11 
GeneralRe: MySQL Pin
loyal ginger25-Jan-10 16:58
loyal ginger25-Jan-10 16:58 
QuestionParamaterised access queries Pin
Russell Jones21-Jan-10 23:31
Russell Jones21-Jan-10 23:31 
AnswerRe: Paramaterised access queries Pin
Eddy Vluggen21-Jan-10 23:58
professionalEddy Vluggen21-Jan-10 23:58 
QuestionNeed some advices on SQL INTERSECT Function Pin
James Shao21-Jan-10 21:19
James Shao21-Jan-10 21:19 
AnswerRe: Need some advices on SQL INTERSECT Function Pin
Dimitri Witkowski24-Jan-10 6:04
Dimitri Witkowski24-Jan-10 6:04 
AnswerRe: Need some advices on SQL INTERSECT Function Pin
Mycroft Holmes24-Jan-10 10:44
professionalMycroft Holmes24-Jan-10 10:44 
I rarely use intersect, so this may not be the best advice but. The above would result in 3 select statements against the same data structure, the results would then be compared and the intersection returned. As Dmitry suggested stick it in a where clause.

You can almost certainly define the set of allowed parameters so some thing like this will do the trick:
ALTER  PROC [DocumentsForEntity]
--DECLARE	
	@FleetID int,
	@RoomID INT,
	@ShipID INT,
	@AutomationID int,
	@CostumeID INT,
	@ShowID INT	
AS
--SET @FleetID = 1
SELECT 
*
FROM dbo.vwDocument
	CROSS JOIN dbo.Settings s
	
WHERE s.SettingCode = 'DocumentURL'
	AND (ISNULL(@FleetID,0) = 0 OR FleetID = @FleetID)
	AND (ISNULL(@RoomID,0) = 0 or RoomID = @Roomid)
	AND (ISNULL(@ShipID,0) = 0 or ShipID = @ShipID)
	AND (ISNULL(@AutomationID,0) = 0 or AutomationID = @AutomationID)
	AND (ISNULL(@CostumeID,0) = 0 or CostumeID = @CostumeID)
	AND (ISNULL(@ShowID,0) = 0 or ShowID = @ShowID)

ORDER BY DocumentType,DocName


The user can then select 1 or more of the parameters.

Never underestimate the power of human stupidity
RAH

GeneralRe: Need some advices on SQL INTERSECT Function Pin
James Shao25-Jan-10 12:06
James Shao25-Jan-10 12:06 
QuestionA Question About Architecture Pin
Roger Wright21-Jan-10 18:02
professionalRoger Wright21-Jan-10 18:02 
AnswerRe: A Question About Architecture Pin
Mycroft Holmes21-Jan-10 21:45
professionalMycroft Holmes21-Jan-10 21:45 
GeneralRe: A Question About Architecture Pin
Roger Wright22-Jan-10 19:41
professionalRoger Wright22-Jan-10 19:41 
GeneralRe: A Question About Architecture Pin
Mycroft Holmes22-Jan-10 20:37
professionalMycroft Holmes22-Jan-10 20:37 
GeneralRe: A Question About Architecture Pin
Roger Wright22-Jan-10 21:00
professionalRoger Wright22-Jan-10 21:00 
QuestionSQL Server Agent not displayed in Object Explorer in SQL Server 2005 Express Edition Pin
tannghia21-Jan-10 16:13
tannghia21-Jan-10 16:13 
AnswerRe: SQL Server Agent not displayed in Object Explorer in SQL Server 2005 Express Edition Pin
Eddy Vluggen22-Jan-10 0:11
professionalEddy Vluggen22-Jan-10 0:11 
Questionout parameters workaround for Ms Access [solved] [modified] Pin
Dan Mos21-Jan-10 10:28
Dan Mos21-Jan-10 10:28 
AnswerRe: out parameters workaround for Ms Access Pin
Mycroft Holmes21-Jan-10 12:05
professionalMycroft Holmes21-Jan-10 12:05 
GeneralRe: out parameters workaround for Ms Access Pin
Dan Mos22-Jan-10 3:13
Dan Mos22-Jan-10 3:13 
AnswerRe: out parameters workaround for Ms Access Pin
Pranay Rana21-Jan-10 17:51
professionalPranay Rana21-Jan-10 17:51 
GeneralRe: out parameters workaround for Ms Access Pin
Dan Mos22-Jan-10 3:09
Dan Mos22-Jan-10 3:09 
QuestionComposite primary key Table Insertion Problem in SQL Pin
vishnukamath20-Jan-10 22:37
vishnukamath20-Jan-10 22:37 
AnswerRe: Composite primary key Table Insertion Problem in SQL Pin
Bassam Saoud22-Jan-10 5:03
Bassam Saoud22-Jan-10 5:03 
Questionselecting first 7 days from database Pin
benjamin yap20-Jan-10 18:02
benjamin yap20-Jan-10 18:02 
AnswerRe: selecting first 7 days from database Pin
Luc Pattyn20-Jan-10 18:12
sitebuilderLuc Pattyn20-Jan-10 18:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.