Click here to Skip to main content
12,242,692 members (67,827 online)
   

Database

 
QuestionGet Filename and import fixed width file Pin
ReallyDumbDudee10-Oct-12 11:15
memberReallyDumbDudee10-Oct-12 11:15 
AnswerRe: Get Filename and import fixed width file Pin
Eddy Vluggen11-Oct-12 13:51
memberEddy Vluggen11-Oct-12 13:51 
QuestionRe: Get Filename and import fixed width file Pin
ReallyDumbDudee11-Oct-12 14:56
memberReallyDumbDudee11-Oct-12 14:56 
AnswerRe: Get Filename and import fixed width file Pin
Eddy Vluggen12-Oct-12 2:04
memberEddy Vluggen12-Oct-12 2:04 
Answer. Pin
SQL Ed10-Oct-12 9:21
memberSQL Ed10-Oct-12 9:21 
AnswerRe: tried to use a case when inside a WHERE clause but did not work. Need more efficient way to cover all IF ELSE scenarios. Pin
Eddy Vluggen10-Oct-12 10:26
memberEddy Vluggen10-Oct-12 10:26 
GeneralRe: tried to use a case when inside a WHERE clause but did not work. Need more efficient way to cover all IF ELSE scenarios. Pin
SQL Ed10-Oct-12 14:15
memberSQL Ed10-Oct-12 14:15 
GeneralRe: tried to use a case when inside a WHERE clause but did not work. Need more efficient way to cover all IF ELSE scenarios. Pin
mark merrens10-Oct-12 14:28
membermark merrens10-Oct-12 14:28 
GeneralRe: tried to use a case when inside a WHERE clause but did not work. Need more efficient way to cover all IF ELSE scenarios. Pin
Jörgen Andersson10-Oct-12 23:26
memberJörgen Andersson10-Oct-12 23:26 
GeneralRe: tried to use a case when inside a WHERE clause but did not work. Need more efficient way to cover all IF ELSE scenarios. Pin
Shameel11-Oct-12 1:27
memberShameel11-Oct-12 1:27 
GeneralRe: tried to use a case when inside a WHERE clause but did not work. Need more efficient way to cover all IF ELSE scenarios. Pin
Eddy Vluggen11-Oct-12 1:35
memberEddy Vluggen11-Oct-12 1:35 
QuestionHow to retrieve client IP address from sql server database Pin
Tridip Bhattacharjee9-Oct-12 21:53
memberTridip Bhattacharjee9-Oct-12 21:53 
AnswerRe: How to retrieve client IP address from sql server database Pin
digimanus10-Oct-12 2:20
memberdigimanus10-Oct-12 2:20 
QuestionMySQL code- Problems with cade when inside a WHERE clause Pin
SQL Ed9-Oct-12 12:31
memberSQL Ed9-Oct-12 12:31 
The following code keeps erroring out in MySQL Workbench. I have not been able to locate the syntax problem. Can anyone see whats wrong with this code. Runnining the code a section at a time still dosn't work. It errors at the first ; where I placed the MAD face. Cannot completely remove the errors they just keep changing places. Also is there a good library of code snippets to view if needed?




/*
PATCH MANAGEMENT
*/

DELIMITER $$
#MachineType means Server or Workstation as determined by the word server in the os field
DROP PROCEDURE IF EXISTS usp_cbi_PatchManagement$$
CREATE PROCEDURE usp_cbi_PatchManagement(MasterGrp varchar(30),Criteria varchar(30),LocationID varchar(30),
ClientName varchar(30))

BEGIN



SELECT IFNULL(COUNT(DISTINCT A.computerid),0) AS 'Dynamic Machine Counts'
FROM (SELECT HF.computerid, HF.hotfixID
FROM hotfixdata HFD
INNER JOIN hotfix HF
ON HF.hotfixid = HFD.hotfixid
AND HFD.ignore <> 1
LEFT OUTER JOIN Computers AS C
ON C.ComputerID=HF.ComputerID
LEFT OUTER JOIN locations AS L
ON C.LocationID=L.LocationID
LEFT OUTER JOIN Clients AS CL
ON C.ClientID=CL.ClientID
JOIN agentcomputers AS AC
ON C.ComputerID=AC.computerid
JOIN mastergroups AS MG
ON AC.groupid=MG.groupId

#Enter Case When here seperating different where clauses.

WHERE


CASE
WHEN

Criteria = 'Workstations Missing Patches'

THEN

INSTR(C.os,"server")=0
AND INSTR(C.os,"microsoft")>0
AND HF.installed <> 1
AND HF.Approved = 1
AND LocationID = L.Name
AND ClientName = Cl.Name
Mad | :mad: AND MasterGrp = MG.Name AND MG.ParentID =0;

WHEN
Criteria = 'Workstations with Empty Patch Tabs'

THEN

HF.hotfixid IS NULL
AND (C.lastcontact > DATE_ADD(NOW(),INTERVAL -7 DAY))
AND INSTR(C.OS,"server")=0
AND INSTR(C.OS,"microsoft")>0
AND LocationID = L.Name
AND ClientName = Cl.Name
AND MasterGrp = MG.Name AND MG.ParentID =0;


WHEN
Criteria = 'Workstations Pending Reboots'

THEN

(C.Flags & 1024) = 1024
AND (C.lastcontact > DATE_ADD(NOW(),INTERVAL -7 DAY))
AND INSTR(C.OS,"server")=0
AND INSTR(C.OS,"microsoft")>0
AND LocationID = L.Name
AND ClientName = C.Name
AND MasterGrp = MG.Name AND MG.ParentID =0;


WHEN
Criteria = 'Total Patch Workstations'

THEN

INSTR(C.os,"server")=0
AND INSTR(C.os,"microsoft")>0
AND LocationID = L.Name
AND ClientName = CL.Name
AND MasterGrp = MG.Name AND MG.ParentID =0;

WHEN
Criteria = 'Servers Missing Patches'

THEN

INSTR(C.os,"server")>0
AND INSTR(C.os,"microsoft")>0
AND HF.installed <> 1
AND HF.Approved = 1
AND LocationID = L.Name
AND ClientName = Cl.Name
AND MasterGrp = MG.Name AND MG.ParentID =0;


WHEN

Criteria = 'Servers Pending Reboots'

THEN

(C.Flags & 1024) = 1024
AND (C.lastcontact > DATE_ADD(NOW(),INTERVAL -7 DAY))
AND INSTR(C.OS,"server")>0
AND INSTR(C.OS,"microsoft")>0
AND LocationID = L.Name
AND ClientName = C.Name
AND MasterGrp = MG.Name AND MG.ParentID =0;

WHEN
Criteria = 'Total Patch Servers'

THEN

INSTR(C.os,"server")>0
AND INSTR(C.os,"microsoft")>0

AND LocationID = L.Name
AND ClientName = CL.Name
AND MasterGrp = MG.Name AND MG.ParentID =0;


WHEN
Criteria = 'Total Patch Machines'

THEN

INSTR(C.os,"microsoft")>0
AND LocationID = 'all'
AND ClientName = 'all'
AND MasterGrp = 'all';

END CASE;

EXCEPTION
WHEN CASE_NOT_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Parameter not found!!');

GROUP BY HF.hotfixID, HF.ComputerID) A;

END;

END$$
AnswerRe: MySQL code- Problems with cade when inside a WHERE clause Pin
Jörgen Andersson9-Oct-12 12:47
memberJörgen Andersson9-Oct-12 12:47 
QuestionDatabase connectivity failure when using ODBC Pin
bharath_ben9-Oct-12 4:16
memberbharath_ben9-Oct-12 4:16 
AnswerRe: Database connectivity failure when using ODBC Pin
Jochen Arndt9-Oct-12 4:43
memberJochen Arndt9-Oct-12 4:43 
GeneralRe: Database connectivity failure when using ODBC Pin
bharath_ben28-Nov-12 4:46
memberbharath_ben28-Nov-12 4:46 
QuestionSQL counting Pin
Qazzy648-Oct-12 9:27
memberQazzy648-Oct-12 9:27 
AnswerRe: SQL counting Pin
scottgp8-Oct-12 10:33
memberscottgp8-Oct-12 10:33 
GeneralRe: SQL counting Pin
Qazzy648-Oct-12 11:07
memberQazzy648-Oct-12 11:07 
QuestionRe: SQL counting Pin
Eddy Vluggen8-Oct-12 14:25
memberEddy Vluggen8-Oct-12 14:25 
AnswerRe: SQL counting Pin
Qazzy648-Oct-12 18:35
memberQazzy648-Oct-12 18:35 
GeneralRe: SQL counting Pin
Eddy Vluggen9-Oct-12 6:08
memberEddy Vluggen9-Oct-12 6:08 
GeneralRe: SQL counting Pin
Qazzy649-Oct-12 8:16
memberQazzy649-Oct-12 8:16 
QuestionProblem in Import XML File From SSIS Pin
mos_tafino@hotmail.com8-Oct-12 2:31
membermos_tafino@hotmail.com8-Oct-12 2:31 
AnswerRe: Problem in Import XML File From SSIS Pin
mos_tafino@hotmail.com8-Oct-12 20:52
membermos_tafino@hotmail.com8-Oct-12 20:52 
QuestionProblem with MySQL stored procedure Pin
jrahma7-Oct-12 8:27
memberjrahma7-Oct-12 8:27 
AnswerRe: Problem with MySQL stored procedure Pin
Jörgen Andersson7-Oct-12 11:43
memberJörgen Andersson7-Oct-12 11:43 
GeneralRe: Problem with MySQL stored procedure Pin
jrahma7-Oct-12 11:52
memberjrahma7-Oct-12 11:52 
AnswerRe: Problem with MySQL stored procedure Pin
Eddy Vluggen8-Oct-12 1:51
memberEddy Vluggen8-Oct-12 1:51 
AnswerRe: Problem with MySQL stored procedure Pin
Bernhard Hiller7-Oct-12 23:26
memberBernhard Hiller7-Oct-12 23:26 
GeneralRe: Problem with MySQL stored procedure Pin
jrahma8-Oct-12 0:31
memberjrahma8-Oct-12 0:31 
AnswerRe: Problem with MySQL stored procedure Pin
Shameel8-Oct-12 2:56
memberShameel8-Oct-12 2:56 
GeneralRe: Problem with MySQL stored procedure Pin
jrahma8-Oct-12 7:54
memberjrahma8-Oct-12 7:54 
GeneralRe: Problem with MySQL stored procedure Pin
jrahma8-Oct-12 8:11
memberjrahma8-Oct-12 8:11 
Questionterminating SqlConnection.Open() call while connecting Pin
Dan_K4-Oct-12 8:43
memberDan_K4-Oct-12 8:43 
AnswerRe: terminating SqlConnection.Open() call while connecting Pin
Shameel4-Oct-12 9:46
memberShameel4-Oct-12 9:46 
AnswerRe: terminating SqlConnection.Open() call while connecting Pin
Eddy Vluggen4-Oct-12 10:10
memberEddy Vluggen4-Oct-12 10:10 
GeneralRe: terminating SqlConnection.Open() call while connecting Pin
Dan_K5-Oct-12 5:37
memberDan_K5-Oct-12 5:37 
GeneralRe: terminating SqlConnection.Open() call while connecting Pin
Eddy Vluggen5-Oct-12 5:57
memberEddy Vluggen5-Oct-12 5:57 
QuestionSQL 2000 to 2008R2 Query Performance Pin
cjb1104-Oct-12 6:13
membercjb1104-Oct-12 6:13 
AnswerRe: SQL 2000 to 2008R2 Query Performance Pin
Shameel4-Oct-12 10:01
memberShameel4-Oct-12 10:01 
GeneralRe: SQL 2000 to 2008R2 Query Performance Pin
cjb1104-Oct-12 23:30
membercjb1104-Oct-12 23:30 
AnswerExecution plan Pin
David Mujica4-Oct-12 11:25
memberDavid Mujica4-Oct-12 11:25 
GeneralRe: Execution plan Pin
cjb1104-Oct-12 21:58
membercjb1104-Oct-12 21:58 
GeneralRe: Execution plan Pin
David Mujica8-Oct-12 9:54
memberDavid Mujica8-Oct-12 9:54 
GeneralRe: Execution plan Pin
cjb1109-Oct-12 0:41
membercjb1109-Oct-12 0:41 
GeneralRe: Execution plan Pin
David Mujica9-Oct-12 4:12
memberDavid Mujica9-Oct-12 4:12 
GeneralRe: Execution plan Pin
cjb1109-Oct-12 5:34
membercjb1109-Oct-12 5:34 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 29 Apr 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid