Click here to Skip to main content
16,018,797 members
Home / Discussions / Database
   

Database

 
QuestionRe: Windows Run Command Pin
Eddy Vluggen1-Oct-12 0:59
professionalEddy Vluggen1-Oct-12 0:59 
QuestionRe: Windows Run Command Pin
Member 94738091-Oct-12 4:28
Member 94738091-Oct-12 4:28 
AnswerRe: Windows Run Command Pin
Eddy Vluggen1-Oct-12 5:09
professionalEddy Vluggen1-Oct-12 5:09 
QuestionRe: Windows Run Command Pin
jojoba20111-Oct-12 22:09
jojoba20111-Oct-12 22:09 
AnswerRe: Windows Run Command Pin
Eddy Vluggen2-Oct-12 0:58
professionalEddy Vluggen2-Oct-12 0:58 
QuestionRe: Windows Run Command Pin
jojoba20112-Oct-12 6:58
jojoba20112-Oct-12 6:58 
AnswerRe: Windows Run Command Pin
Eddy Vluggen2-Oct-12 8:08
professionalEddy Vluggen2-Oct-12 8:08 
QuestionMySQL Question Pin
SQL Ed28-Sep-12 4:21
SQL Ed28-Sep-12 4:21 
I am trying to run the following code in MySQL without using a procedure or function. I keep getting a syntax error. Does anyone see anything wrong with this code. Am I able to run this code without using a procedure or function.


DECLARE @Machine varchar(30);
SET @Machine = @MachineType;



IF @Machine = 'server'
THEN SELECT COUNT(*) AS 'Total Servers'
FROM agentcomputers AS A
WHERE A.groupid IN('521','637');

ELSEIF @Machine = 'bdr server'
THEN SELECT COUNT(*) AS 'Total BDR Servers'
FROM agentcomputers AS A
WHERE A.groupid =521;

ELSEIF @Machine = 'non-bdr server'
THEN SELECT COUNT(*) AS 'Total Non-BDR Servers'
FROM agentcomputers AS A
WHERE A.groupid =637;


ELSEIF @Machine = 'workstation'
THEN SELECT COUNT(*) AS 'Total Workstations'
FROM agentcomputers AS A
WHERE A.groupid =638;

ELSEIF @Machine = 'laptop'
THEN SELECT COUNT(*) AS 'Total Laptops'
FROM agentcomputers AS A
WHERE A.groupid =650;

ELSEIF @Machine = 'monitored computer'
THEN SELECT COUNT(*) AS 'Total Monitored Computers'
FROM agentcomputers AS A
WHERE A.groupid =1;

ELSEIF @Machine = 'new computer'
THEN SELECT COUNT(*) AS 'Total New Computers'
FROM agentcomputers AS A
WHERE A.groupid =648;


ELSEIF @Machine = 'managed service'
THEN SELECT COUNT(*) AS 'Total Managed Services'
FROM agentcomputers AS A
WHERE A.groupid =522;

ELSEIF @Machine = 'allmachines'
THEN SELECT COUNT(*) AS 'Total Machines'
FROM agentcomputers AS A
WHERE A.groupid IN('1','521','522','637','638','648','650');

/*
THESE IF STATEMENTS RETURN THE COUNTS FOR THE MOBIL DEVICES
*/

ELSEIF @Machine = 'phone'
THEN SELECT COUNT(*) AS 'Total Mobil Phones'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=2;

ELSEIF @Machine = 'tablet'
THEN SELECT COUNT(*) AS 'Total Mobil Tablets'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=3;

ELSEIF @Machine = 'ios'
THEN SELECT COUNT(*) AS 'Total Mobil iOS Devices'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=4;

ELSEIF @Machine = 'android'
THEN SELECT COUNT(*) AS 'Total Mobil Android Devices'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=5;


ELSEIF @Machine = 'allmobil'
THEN SELECT COUNT(*) AS 'Total Mobil Devices'
FROM mobiledevices AS M;




END IF;
AnswerRe: MySQL Question Pin
Eddy Vluggen29-Sep-12 2:38
professionalEddy Vluggen29-Sep-12 2:38 
QuestionRemoving the updated row Pin
sindhuan28-Sep-12 1:48
sindhuan28-Sep-12 1:48 
QuestionMySQL sql statement question Pin
Jassim Rahma27-Sep-12 9:28
Jassim Rahma27-Sep-12 9:28 
AnswerRe: MySQL sql statement question Pin
jschell27-Sep-12 10:12
jschell27-Sep-12 10:12 
GeneralRe: MySQL sql statement question Pin
Jassim Rahma27-Sep-12 11:08
Jassim Rahma27-Sep-12 11:08 
GeneralRe: MySQL sql statement question Pin
Eddy Vluggen29-Sep-12 2:42
professionalEddy Vluggen29-Sep-12 2:42 
QuestionIs there a try/finally construct in sqlcmd with -b option, guaranteed to execute the finally block? Pin
muhalet27-Sep-12 0:56
muhalet27-Sep-12 0:56 
AnswerRe: Is there a try/finally construct in sqlcmd with -b option, guaranteed to execute the finally block? Pin
Eddy Vluggen27-Sep-12 1:42
professionalEddy Vluggen27-Sep-12 1:42 
GeneralRe: Is there a try/finally construct in sqlcmd with -b option, guaranteed to execute the finally block? Pin
J4amieC27-Sep-12 2:51
J4amieC27-Sep-12 2:51 
QuestionRe: Is there a try/finally construct in sqlcmd with -b option, guaranteed to execute the finally block? Pin
Eddy Vluggen27-Sep-12 4:27
professionalEddy Vluggen27-Sep-12 4:27 
AnswerRe: Is there a try/finally construct in sqlcmd with -b option, guaranteed to execute the finally block? Pin
J4amieC27-Sep-12 21:29
J4amieC27-Sep-12 21:29 
Questionsql script Pin
sindhuan26-Sep-12 20:08
sindhuan26-Sep-12 20:08 
AnswerRe: sql script Pin
Ingo26-Sep-12 21:10
Ingo26-Sep-12 21:10 
GeneralRe: sql script Pin
sindhuan26-Sep-12 21:21
sindhuan26-Sep-12 21:21 
AnswerRe: sql script Pin
Ingo26-Sep-12 21:44
Ingo26-Sep-12 21:44 
AnswerRe: sql script Pin
J4amieC26-Sep-12 21:46
J4amieC26-Sep-12 21:46 
GeneralRe: sql script Pin
sindhuan26-Sep-12 23:30
sindhuan26-Sep-12 23:30 

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.