• Linq Predicate And and Predicate Or to sql conversion 2017-12-14

    LINQ library has a predicate "and" and predicate "or" functionality that works as below. There are two questions that i would like to ask: How would the following LINQ statement be when being translated or written in SQL? Is there a st

    Tags: sql, linq
  • keep int specific length in database 2017-12-13

    I am wanting to make sure that all values within my column (accountNumber) are exactly 7 characters long. I have tried this: CREATE TABLE `account` ( `accountNumber` int(7) NOT NULL AUTO_INCREMENT, ... CHECK (accountNumber >6), CHECK (accountNumber <

    Tags: database, mysql, sql
  • How to select data from 2 tables and convert NULL to 0? 2017-12-09

    I have 2 tables, Table1 (Id, Name, Email) and Table2 (Id, ItemName, Price, IsShipping). I need to join them on Id columns, but IsShipping column has NULL values, I need to change NULL to 0. For now I have: SELECT Table1.Id, Table1.Name, Table1.Email,

    Tags: sql, sql server
  • Updating Date Field in SQL 2017-12-05

    I'm trying to update a date (MM/DD/YYYY) using SQL in a C# program that uses an Access Database. The field only has a date and no time. However, I keep getting a Syntax error when I test the SQL in Access and a Microsoft Access Database Engine error

    Tags: sql, ms access, datetime, sql update
  • C# - Compare contents of flat file and a Microsoft SQL Server table 2017-11-28

    I'm still a newbie to the C# world. I currently have a pipe delimited .txt file and it corresponds to a table called dbo.rawAccount. In both the flat file and the table I have a column called AccountKey but I also have several other columns in both t

    Tags: sql, tsql
  • How do I split results containing multiple columns into two rows each 2017-11-27

    I am trying to split my output into two rows for each rather than just one. I'll eventually want to do an insert by looping through each one of these returns but one step at a time. select m6.mrid ,'6' as 'FromProj' ,m10.mrid ,'10' as 'ToProj' from m

    Tags: sql, sql server
  • Sql Access COUNT Numbers and Return the Amount 2017-11-25

    Select COUNT([OwnerID]) AS Amount FROM [A Data] GROUP BY [OwnerID] HAVING ( COUNT([OwnerID]) > 1 ); The code above will show the amount of users that have more than 1 toy for example results are: Owner 1 = 2 Owner 2 = 3 I'm struggling in showing only

    Tags: sql, ms access
  • SQL query - condition on a column value within a set 2017-11-23

    I need to query something like this SELECT * WHERE (ORDER_ID='AAA' or ORDER_ID='BBB'); I notice that's somehow significantly slower than running SELECT * WHERE ORDER_ID='AAA'; SELECT * WHERE ORDER_ID='BBB'; Seperately. Is there a reason why? what's t

    Tags: sql, oracle
  • Can't get rows for zero values in SQL query with COUNT, CASE and 3 JOINs (4 tables) 2017-11-10

    I am trying to get a row for each combination of CELLNAME and LANGUAGE but I can't get rows for zero counts. For example if a CELLNAME 'x' doesn't contain any CLIENT_ID or CLNOCL with language code DE I don't get a row with zero count. This works per

    Tags: sql, oracle, count
  • SQL query running current value by date 2017-11-08

    I'm trying to write a query that returns the last non-null value next to all subsequent dates until a new non-null value is encountered.The input table would look something like this: DATE VALUE ========== ====== 01/01/2015 1 02/01/2015 NULL 03/01/20

    Tags: sql, sql server
  • What index should I use for IS NOT NULL queries 2017-10-28

    The following is my table schema :- +---------+---------+----------+ | ID | COL1 | COL2 | +---------+---------+----------+ | 1 | NULL | 1 | | 2 | 1 | NULL | | 3 | NULL | NULL | +---------+---------+----------+ Now, I have to run queries like :- SELEC

    Tags: mysql, sql
  • SCCM2012 SQL Query has an error 2017-10-16

    I am creating an SQL query for my SCCM collection but I get that there is an error. It doesn't tell me what the error is and the rule looks ok for me. Select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueId

    Tags: sql, sccm
  • Trigger on specific cell in SQL Server 2017-10-12

    I have a SQL Server database with users. I want to keep one specific user from changing his picture. I don't believe there is a way to make a single cell immutable but is there a way to create a trigger that is called so that whenever this person cha

    Tags: database, sql, sql server, triggers
  • Calculating days of therapy in a sql query 2017-09-24

    I'm attempting to calculate days of therapy by month from an oracle database. The (vastly simplified) data is as follows: Therapies +-----------+-----------+----------+ | Rx Number | StartDate | StopDate | |-----------+-----------+----------| | 1 | 1

    Tags: sql, oracle
  • how to create sql-insert statement for each element/attribute from a XML-File 2017-09-18

    I've got an xml file like this (in fact its much larger) and I have to create an SQLinsert statement for each element and attribute. If possible I should include in each statement also the ancestor nodes and a sort_no which should automatically count

    Tags: sql, xml, insert, element
  • Eliminating a space in concatenated values when null 2017-09-17

    My SELECT statement reads something like this: SELECT JKLL.LKJJ, LKJF.ASLKD, TRIM (ADDR.UNNBR) || ' ' || TRIM(ADDR.PREDIR) || ' ' ||, TRIM(ADDR.STREET).... Where UNNBR is the address number and PREDIR is the predirection (NSEW). When concatenating in

    Tags: sql, sql server
  • How to find file size of tables where column id = value in postgres/sql 2017-09-11

    How would I find the total size of tables where the column_id = 'value'? I have a column which is called 'platform_id' and it is within many tables within my database, but not all of them. I am trying to figure out how large the tables are that have

    Tags: sql, postgresql
  • SQL query for allocation of managers fulfilling given criteria 2017-09-06

    I have a list of sellers and i have to allocated them managers. The data format is as below Seller category Division Sales David 17 A 5000 David 23 B 2000 David 91 C 100 David 25 C 200 Jack 23 A 4000 Jack 17 A 4000 Jack 25 B 3000 Now the list of mana

    Tags: mysql, sql
  • PHP and SQL INSERT INTO with variables dont works 2017-09-05

    Has anyone an idea of what is wrong in this code? $sql = "INSERT INTO quiz.fr_fragen (fr_id, fr_frage, a1, a2, a3, a4, fr_kategorie) VALUES ('$id', '$frage', '$a1', '$a2', '$a3', '$a4', '$kat');"; Table names are 100% correct. The variables are

    Tags: php, sql, sql insert
  • Issue with SQL query Microsoft Office Access Database Engine error '80040e14 2017-08-27

    I am using ASP to build a website and need to use an SQL query to search based on a form. I am however receiving Microsoft Office Access Database Engine error '80040e14 The code I am using is searchFor = Request.Form( "searchFor" ) maxPrice = Re

    Tags: sql, asp classic, ms access

Copyright (C) dskims.com, All Rights Reserved.

processed in 2.591 (s). 9 q(s)