Writing a query that will handle three different labels The Next CEO of Stack OverflowWhat is the difference between “INNER JOIN” and “OUTER JOIN”?What is the difference between UNION and UNION ALL?Inserting multiple rows in a single SQL query?How to query MongoDB with “like”?missing dataset in Reporting Services Report after Moving TFSSQL Server Reporting Services in TFSCRM Reports not getting executed for more than 20 recordsSQ Server 2008 r2 Reporting Services : optional parameter values and reportsReporting service in TFS 2013Not able to Trim or remove Hexadecimal character from SSRS report parameter

What exact does MIB represent in SNMP? How is it different from OID?

To not tell, not take, and not want

Is it ever safe to open a suspicious html file (e.g. email attachment)?

What is "(CFMCC)" on an ILS approach chart?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Received an invoice from my ex-employer billing me for training; how to handle?

What can we do to stop prior company from asking us questions?

Several mode to write the symbol of a vector

Is "for causing autism in X" grammatical?

Unreliable Magic - Is it worth it?

How to solve a differential equation with a term to a power?

Novel about a guy who is possessed by the divine essence and the world ends?

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

Non-deterministic sum of floats

What was the first Unix version to run on a microcomputer?

If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?

Why do remote companies require working in the US?

Skipping indices in a product

Has this building technique been used in an official set?

What happened in Rome, when the western empire "fell"?

Should I tutor a student who I know has cheated on their homework?

How do I avoid eval and parse?

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Would a completely good Muggle be able to use a wand?



Writing a query that will handle three different labels



The Next CEO of Stack OverflowWhat is the difference between “INNER JOIN” and “OUTER JOIN”?What is the difference between UNION and UNION ALL?Inserting multiple rows in a single SQL query?How to query MongoDB with “like”?missing dataset in Reporting Services Report after Moving TFSSQL Server Reporting Services in TFSCRM Reports not getting executed for more than 20 recordsSQ Server 2008 r2 Reporting Services : optional parameter values and reportsReporting service in TFS 2013Not able to Trim or remove Hexadecimal character from SSRS report parameter










0















I have 3 different drop down options. If I select one option at a time it works, but on selecting more than one it will throw an error. The three labels refer to three different versions. Everything works but when I select more than one option in the drop down it crashes. Need help understanding it why



The three parameters are
Select all:
Report1
Report2
Report3



Here my query:



SELECT
ServerInfo.Version,
ServerInfo.Type,
ProjInfo.ProjName,
ServerInfo.ServName
FROM
ProjInfo, ServerInfo
WHERE ServerInfo.Version LIKE('%'+@ServerReport+'%')



Incorrect syntax near ','.



Query execution failed for dataset 'Report'. (rsErrorExecutingCommand)



An error has occurred during report processing. (rsProcessingAborted)










share|improve this question
























  • Is the issues has to do with casting? Or should I write down individual cases statements for each of the label options ?

    – LooperBoy
    Mar 21 at 17:30











  • Please provide more info, what are the three labels values? What variable does it populate, ServerReport? What is the value of that variable when you select 1 or more option?

    – Michael Muryn
    Mar 21 at 17:35















0















I have 3 different drop down options. If I select one option at a time it works, but on selecting more than one it will throw an error. The three labels refer to three different versions. Everything works but when I select more than one option in the drop down it crashes. Need help understanding it why



The three parameters are
Select all:
Report1
Report2
Report3



Here my query:



SELECT
ServerInfo.Version,
ServerInfo.Type,
ProjInfo.ProjName,
ServerInfo.ServName
FROM
ProjInfo, ServerInfo
WHERE ServerInfo.Version LIKE('%'+@ServerReport+'%')



Incorrect syntax near ','.



Query execution failed for dataset 'Report'. (rsErrorExecutingCommand)



An error has occurred during report processing. (rsProcessingAborted)










share|improve this question
























  • Is the issues has to do with casting? Or should I write down individual cases statements for each of the label options ?

    – LooperBoy
    Mar 21 at 17:30











  • Please provide more info, what are the three labels values? What variable does it populate, ServerReport? What is the value of that variable when you select 1 or more option?

    – Michael Muryn
    Mar 21 at 17:35













0












0








0








I have 3 different drop down options. If I select one option at a time it works, but on selecting more than one it will throw an error. The three labels refer to three different versions. Everything works but when I select more than one option in the drop down it crashes. Need help understanding it why



The three parameters are
Select all:
Report1
Report2
Report3



Here my query:



SELECT
ServerInfo.Version,
ServerInfo.Type,
ProjInfo.ProjName,
ServerInfo.ServName
FROM
ProjInfo, ServerInfo
WHERE ServerInfo.Version LIKE('%'+@ServerReport+'%')



Incorrect syntax near ','.



Query execution failed for dataset 'Report'. (rsErrorExecutingCommand)



An error has occurred during report processing. (rsProcessingAborted)










share|improve this question
















I have 3 different drop down options. If I select one option at a time it works, but on selecting more than one it will throw an error. The three labels refer to three different versions. Everything works but when I select more than one option in the drop down it crashes. Need help understanding it why



The three parameters are
Select all:
Report1
Report2
Report3



Here my query:



SELECT
ServerInfo.Version,
ServerInfo.Type,
ProjInfo.ProjName,
ServerInfo.ServName
FROM
ProjInfo, ServerInfo
WHERE ServerInfo.Version LIKE('%'+@ServerReport+'%')



Incorrect syntax near ','.



Query execution failed for dataset 'Report'. (rsErrorExecutingCommand)



An error has occurred during report processing. (rsProcessingAborted)







sql reporting-services ssrs-2012






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 17:54







LooperBoy

















asked Mar 21 at 17:09









LooperBoyLooperBoy

193




193












  • Is the issues has to do with casting? Or should I write down individual cases statements for each of the label options ?

    – LooperBoy
    Mar 21 at 17:30











  • Please provide more info, what are the three labels values? What variable does it populate, ServerReport? What is the value of that variable when you select 1 or more option?

    – Michael Muryn
    Mar 21 at 17:35

















  • Is the issues has to do with casting? Or should I write down individual cases statements for each of the label options ?

    – LooperBoy
    Mar 21 at 17:30











  • Please provide more info, what are the three labels values? What variable does it populate, ServerReport? What is the value of that variable when you select 1 or more option?

    – Michael Muryn
    Mar 21 at 17:35
















Is the issues has to do with casting? Or should I write down individual cases statements for each of the label options ?

– LooperBoy
Mar 21 at 17:30





Is the issues has to do with casting? Or should I write down individual cases statements for each of the label options ?

– LooperBoy
Mar 21 at 17:30













Please provide more info, what are the three labels values? What variable does it populate, ServerReport? What is the value of that variable when you select 1 or more option?

– Michael Muryn
Mar 21 at 17:35





Please provide more info, what are the three labels values? What variable does it populate, ServerReport? What is the value of that variable when you select 1 or more option?

– Michael Muryn
Mar 21 at 17:35












1 Answer
1






active

oldest

votes


















0














The problem here is that the query is expecting a single string value, but the report is sending it an array of values when there are multiples selected.




  1. In the parameter tab of your dataset properties, update the expression like this:



    ="," & Join(Parameters!ServerReport.Value, ",") & ","



    This will combine the selected values into a single, comma-separated string.




  2. Update your WHERE clause like this:



    @ServerReport like '%,' + ServerInfo.Version + ',%'



This allows it to scan for the version string in the parameter string. The commas on the outside of both the joined parameter and the like statement prevent it from inadvertently matching partial strings.



Clarification:
This is all assuming that you actually need the like statement in the first place. Normally you would just say:



ServerInfo.Version IN (@ServerReport)


This would accept multiple values without any other changes. But the strings would have to be an exact match.






share|improve this answer























  • The three labels that I have in ServerReport are Report1 Report2 Report3. Report 1 is set to 10 , Report2 is 13 , and Report3 is set to 14. Since there are three different version in the database, that start with these three values. Version are set like 10.12.12 for example. That why I was using Like condition

    – LooperBoy
    Mar 21 at 18:14












  • I try this solution but it doesn't populate any results at all. Do I need to use a case condition for each of the report values?

    – LooperBoy
    Mar 21 at 18:19











  • If you search for Report 1 (10), won't it return results like 9.10, 10.10, 13.10, and 14.10 ? What is your intended result?

    – StevenWhite
    Mar 21 at 18:31











  • My intended result should be: Report1(label value is set to 10). It should display version results that start with 10. for example 10.20.10 , 10.34.10. I'm basically trying to do a comparison if Report1 is selected display all the results that start with 10. If report2 is selected display all the results with 13

    – LooperBoy
    Mar 21 at 18:40











  • OK, set your WHERE clause like this to search the first set of digits in the version number: @ServerReport like '%' + LEFT(ServerInfo.Version, CHARINDEX('.', ServerInfo.Version) - 1) + '%'

    – StevenWhite
    Mar 21 at 18:53











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285761%2fwriting-a-query-that-will-handle-three-different-labels%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The problem here is that the query is expecting a single string value, but the report is sending it an array of values when there are multiples selected.




  1. In the parameter tab of your dataset properties, update the expression like this:



    ="," & Join(Parameters!ServerReport.Value, ",") & ","



    This will combine the selected values into a single, comma-separated string.




  2. Update your WHERE clause like this:



    @ServerReport like '%,' + ServerInfo.Version + ',%'



This allows it to scan for the version string in the parameter string. The commas on the outside of both the joined parameter and the like statement prevent it from inadvertently matching partial strings.



Clarification:
This is all assuming that you actually need the like statement in the first place. Normally you would just say:



ServerInfo.Version IN (@ServerReport)


This would accept multiple values without any other changes. But the strings would have to be an exact match.






share|improve this answer























  • The three labels that I have in ServerReport are Report1 Report2 Report3. Report 1 is set to 10 , Report2 is 13 , and Report3 is set to 14. Since there are three different version in the database, that start with these three values. Version are set like 10.12.12 for example. That why I was using Like condition

    – LooperBoy
    Mar 21 at 18:14












  • I try this solution but it doesn't populate any results at all. Do I need to use a case condition for each of the report values?

    – LooperBoy
    Mar 21 at 18:19











  • If you search for Report 1 (10), won't it return results like 9.10, 10.10, 13.10, and 14.10 ? What is your intended result?

    – StevenWhite
    Mar 21 at 18:31











  • My intended result should be: Report1(label value is set to 10). It should display version results that start with 10. for example 10.20.10 , 10.34.10. I'm basically trying to do a comparison if Report1 is selected display all the results that start with 10. If report2 is selected display all the results with 13

    – LooperBoy
    Mar 21 at 18:40











  • OK, set your WHERE clause like this to search the first set of digits in the version number: @ServerReport like '%' + LEFT(ServerInfo.Version, CHARINDEX('.', ServerInfo.Version) - 1) + '%'

    – StevenWhite
    Mar 21 at 18:53















0














The problem here is that the query is expecting a single string value, but the report is sending it an array of values when there are multiples selected.




  1. In the parameter tab of your dataset properties, update the expression like this:



    ="," & Join(Parameters!ServerReport.Value, ",") & ","



    This will combine the selected values into a single, comma-separated string.




  2. Update your WHERE clause like this:



    @ServerReport like '%,' + ServerInfo.Version + ',%'



This allows it to scan for the version string in the parameter string. The commas on the outside of both the joined parameter and the like statement prevent it from inadvertently matching partial strings.



Clarification:
This is all assuming that you actually need the like statement in the first place. Normally you would just say:



ServerInfo.Version IN (@ServerReport)


This would accept multiple values without any other changes. But the strings would have to be an exact match.






share|improve this answer























  • The three labels that I have in ServerReport are Report1 Report2 Report3. Report 1 is set to 10 , Report2 is 13 , and Report3 is set to 14. Since there are three different version in the database, that start with these three values. Version are set like 10.12.12 for example. That why I was using Like condition

    – LooperBoy
    Mar 21 at 18:14












  • I try this solution but it doesn't populate any results at all. Do I need to use a case condition for each of the report values?

    – LooperBoy
    Mar 21 at 18:19











  • If you search for Report 1 (10), won't it return results like 9.10, 10.10, 13.10, and 14.10 ? What is your intended result?

    – StevenWhite
    Mar 21 at 18:31











  • My intended result should be: Report1(label value is set to 10). It should display version results that start with 10. for example 10.20.10 , 10.34.10. I'm basically trying to do a comparison if Report1 is selected display all the results that start with 10. If report2 is selected display all the results with 13

    – LooperBoy
    Mar 21 at 18:40











  • OK, set your WHERE clause like this to search the first set of digits in the version number: @ServerReport like '%' + LEFT(ServerInfo.Version, CHARINDEX('.', ServerInfo.Version) - 1) + '%'

    – StevenWhite
    Mar 21 at 18:53













0












0








0







The problem here is that the query is expecting a single string value, but the report is sending it an array of values when there are multiples selected.




  1. In the parameter tab of your dataset properties, update the expression like this:



    ="," & Join(Parameters!ServerReport.Value, ",") & ","



    This will combine the selected values into a single, comma-separated string.




  2. Update your WHERE clause like this:



    @ServerReport like '%,' + ServerInfo.Version + ',%'



This allows it to scan for the version string in the parameter string. The commas on the outside of both the joined parameter and the like statement prevent it from inadvertently matching partial strings.



Clarification:
This is all assuming that you actually need the like statement in the first place. Normally you would just say:



ServerInfo.Version IN (@ServerReport)


This would accept multiple values without any other changes. But the strings would have to be an exact match.






share|improve this answer













The problem here is that the query is expecting a single string value, but the report is sending it an array of values when there are multiples selected.




  1. In the parameter tab of your dataset properties, update the expression like this:



    ="," & Join(Parameters!ServerReport.Value, ",") & ","



    This will combine the selected values into a single, comma-separated string.




  2. Update your WHERE clause like this:



    @ServerReport like '%,' + ServerInfo.Version + ',%'



This allows it to scan for the version string in the parameter string. The commas on the outside of both the joined parameter and the like statement prevent it from inadvertently matching partial strings.



Clarification:
This is all assuming that you actually need the like statement in the first place. Normally you would just say:



ServerInfo.Version IN (@ServerReport)


This would accept multiple values without any other changes. But the strings would have to be an exact match.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 21 at 17:47









StevenWhiteStevenWhite

4,68321137




4,68321137












  • The three labels that I have in ServerReport are Report1 Report2 Report3. Report 1 is set to 10 , Report2 is 13 , and Report3 is set to 14. Since there are three different version in the database, that start with these three values. Version are set like 10.12.12 for example. That why I was using Like condition

    – LooperBoy
    Mar 21 at 18:14












  • I try this solution but it doesn't populate any results at all. Do I need to use a case condition for each of the report values?

    – LooperBoy
    Mar 21 at 18:19











  • If you search for Report 1 (10), won't it return results like 9.10, 10.10, 13.10, and 14.10 ? What is your intended result?

    – StevenWhite
    Mar 21 at 18:31











  • My intended result should be: Report1(label value is set to 10). It should display version results that start with 10. for example 10.20.10 , 10.34.10. I'm basically trying to do a comparison if Report1 is selected display all the results that start with 10. If report2 is selected display all the results with 13

    – LooperBoy
    Mar 21 at 18:40











  • OK, set your WHERE clause like this to search the first set of digits in the version number: @ServerReport like '%' + LEFT(ServerInfo.Version, CHARINDEX('.', ServerInfo.Version) - 1) + '%'

    – StevenWhite
    Mar 21 at 18:53

















  • The three labels that I have in ServerReport are Report1 Report2 Report3. Report 1 is set to 10 , Report2 is 13 , and Report3 is set to 14. Since there are three different version in the database, that start with these three values. Version are set like 10.12.12 for example. That why I was using Like condition

    – LooperBoy
    Mar 21 at 18:14












  • I try this solution but it doesn't populate any results at all. Do I need to use a case condition for each of the report values?

    – LooperBoy
    Mar 21 at 18:19











  • If you search for Report 1 (10), won't it return results like 9.10, 10.10, 13.10, and 14.10 ? What is your intended result?

    – StevenWhite
    Mar 21 at 18:31











  • My intended result should be: Report1(label value is set to 10). It should display version results that start with 10. for example 10.20.10 , 10.34.10. I'm basically trying to do a comparison if Report1 is selected display all the results that start with 10. If report2 is selected display all the results with 13

    – LooperBoy
    Mar 21 at 18:40











  • OK, set your WHERE clause like this to search the first set of digits in the version number: @ServerReport like '%' + LEFT(ServerInfo.Version, CHARINDEX('.', ServerInfo.Version) - 1) + '%'

    – StevenWhite
    Mar 21 at 18:53
















The three labels that I have in ServerReport are Report1 Report2 Report3. Report 1 is set to 10 , Report2 is 13 , and Report3 is set to 14. Since there are three different version in the database, that start with these three values. Version are set like 10.12.12 for example. That why I was using Like condition

– LooperBoy
Mar 21 at 18:14






The three labels that I have in ServerReport are Report1 Report2 Report3. Report 1 is set to 10 , Report2 is 13 , and Report3 is set to 14. Since there are three different version in the database, that start with these three values. Version are set like 10.12.12 for example. That why I was using Like condition

– LooperBoy
Mar 21 at 18:14














I try this solution but it doesn't populate any results at all. Do I need to use a case condition for each of the report values?

– LooperBoy
Mar 21 at 18:19





I try this solution but it doesn't populate any results at all. Do I need to use a case condition for each of the report values?

– LooperBoy
Mar 21 at 18:19













If you search for Report 1 (10), won't it return results like 9.10, 10.10, 13.10, and 14.10 ? What is your intended result?

– StevenWhite
Mar 21 at 18:31





If you search for Report 1 (10), won't it return results like 9.10, 10.10, 13.10, and 14.10 ? What is your intended result?

– StevenWhite
Mar 21 at 18:31













My intended result should be: Report1(label value is set to 10). It should display version results that start with 10. for example 10.20.10 , 10.34.10. I'm basically trying to do a comparison if Report1 is selected display all the results that start with 10. If report2 is selected display all the results with 13

– LooperBoy
Mar 21 at 18:40





My intended result should be: Report1(label value is set to 10). It should display version results that start with 10. for example 10.20.10 , 10.34.10. I'm basically trying to do a comparison if Report1 is selected display all the results that start with 10. If report2 is selected display all the results with 13

– LooperBoy
Mar 21 at 18:40













OK, set your WHERE clause like this to search the first set of digits in the version number: @ServerReport like '%' + LEFT(ServerInfo.Version, CHARINDEX('.', ServerInfo.Version) - 1) + '%'

– StevenWhite
Mar 21 at 18:53





OK, set your WHERE clause like this to search the first set of digits in the version number: @ServerReport like '%' + LEFT(ServerInfo.Version, CHARINDEX('.', ServerInfo.Version) - 1) + '%'

– StevenWhite
Mar 21 at 18:53



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285761%2fwriting-a-query-that-will-handle-three-different-labels%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript