How do you perform an IF...THEN in a SQL SELECT
I want to be able to perform a IF...THEN in an SQL SELECT Statement. For Example; SELECT IF(Obsolete = 'N' or InStock = 'Y';1;0) as Salable, * FROM Product ...
I want to be able to perform a IF...THEN in an SQL SELECT Statement. For Example; SELECT IF(Obsolete = 'N' or InStock = 'Y';1;0) as Salable, * FROM Product ...
I have been sick and tired Googling the solution for doing case-insensitive search on Sybase ASE (Sybase data/column names are case sensitive). The Sybase documentation proudly says that there is only one way to do such search which is using the Upper and Lower functions, but the adage goes, it has performance problems. And believe me th...
I have an external variable coming in as a string and I would like to do a switch/case on it. How do I do that in xquery? ...
Hi, I'm currently generating SQL insert statements from more than one tables, and in the generated data I need to use a CASE statement, like this: select 'INSERT INTO TABLE1 (f1, f2, f3, f4 ...) values (' ||t.f1||',' ||CASE WHEN t.f2 > 0 THEN '1' ELSE '0' END CASE from table2 t , table...
I am looking for free and/or open source requirements management tools. Does anyone have any experience with these tools and can recommend one or two? Thanks. ...
I tried searching around but couldn't find anything that would help me out. I'm trying to do this in SQL: declare @locationType varchar(50); declare @locationID int; SELECT column1, column2 FROM viewWhatever WHERE CASE @locationType WHEN 'location' THEN account_location = @locationID WHEN 'area' THEN xxx_location_area = @locat...
is there such thing (in PHP anyway) for an OR operator in a switch case? something like.. switch ($value) { case 1 || 2: echo 'the value is either 1 or 2'; break; } ...
How do you make a field in a sql select statement all upper or lower case? Example: select firstname from Person How do I make firstname always return upper case and likewise always return lower case? ...
I'm trying to make the following code smaller. Is this possible? select a.* from table1 a WHERE a."cola1" = 'valuea1' UNION ALL select a.* from tablea1 a inner join tablea2 b on a."cola2" = b."colb2" WHERE a."cola1" = 'valuea2' and b."colb3" = 'valueb3' In effect I'm looking for records from table1 for value1 or value2, but for rec...
Im having problems building a query with the linq to sql data query expression in c#. What I'm trying to ultimately do is based on this pseudo-code expression. public IQueryable<CTest> searchRecords(string category, string searchString, DateTime startDate, DateTime endDate, int searchType, int searchType2) { //-Sear...
Is it absolutely necessary to use "arrows" to show association between an actor and a use case in a use case diagram? I recently had to draw one for my Software Engineering assignment. But after doing a bit of research online on many articles, papers, online books and lecture notes from numerous other universities, it seemed that majori...
Hi everyone, I would really appreciate help with this, I am seriously stuck. Basically I have a table that looks like this: SSS_DOWID Name Mon Tue Wed Thu Fri Sat Sun Description 2 M Y N N N N N N Monday 3 MF Y N N N Y N N Monday, Friday ....... 18 ...
Hi :) I have multiple switch statements in on one of the pages in order to pass different vsriables to the URL, as well as different case. I need these different switch statements because I need the different variables. However, when I put a "default" in one of the switch statements, that default applies to every other switch statement...
I'm working on an ASP.NET application which is supposed to output detector data for a chosen interstate, sorted by mile marker. We determined the best way to do this would be sorting it by longitude (West and East) or latitude(North and South) depending on which direction it goes. Here's the query that populates it. SELECT [ShortWebID],...
DECLARE @TestVal int SET @TestVal = 5 SELECT CASE WHEN @TestVal <=3 THEN 'Top 3' ELSE 'Other' END I saw this sample code online but I couldn't find an example where there was no expression and it had more than one WHEN, so I am wondering if this type of thing is OK: DECLARE @TestVal int SET @TestVal = 5 SEL...
Consider the following two snippets, with braces: switch (var) { case FOO: { x = x + 1; break; } case BAR: { y = y + 1; break; } } Without braces: switch (var) { case FOO: x = x + 1; break; case BAR: y = y + 1; break; } I know that, in the snippet with braces, a new scope is created...
Is it possible to use a Case statement in a sql From clause. For example, I'm trying something like: SELECT Md5 FROM CASE WHEN @ClientType = 'Employee' THEN @Source = 'HR' WHEN @ClientType = 'Member' THEN @Source = 'Other' END CASE WHERE Current = 2; Edit: Using SQL 2005 ...
Say we have the following case: Jen Ninja (a Developer with an awesome last name) likes to look at the following list view filter: All open cases assigned to Jen Ninja with the status of Active Jen Ninja gets assigned a bunch of cases (some of them bugs, some of them features). Jen looks at her filtered list and see them. No problem...
Ok, this may sound a little weird, but what I need to do is simple. I have a list of companies and each one has a description. The site is in 4 languages. My problem comes when I have listed a company in English but the person who is in charge of translating it in French still didn't make the translation, so I have a simple: SELECT TOP(...
If you want to switch on a type of object, what is the best way to do this? Code snippet private int GetNodeType(NodeDTO node) { switch (node.GetType()) { case typeof(CasusNodeDTO): return 1; case typeof(BucketNodeDTO): return 3; case typeof(BranchNodeDTO): return 0; ...