Tagged Questions
0
votes
1answer
26 views
SQL JOIN vs. multiple SELECT statements
Every developer working with databases has this problem.
And often you can not estimate how many records a table will have in x years.
LEFT JOIN vs. multiple SELECT statements
performance - single ...
1
vote
1answer
14 views
Removing a combination of strings from a column
I had asked a similar question earlier today but realized I had some flaws in my logic since I had made some assumptions.
What I'm trying to do is eliminate certain words from appearing in a ...
0
votes
0answers
59 views
SQL query returning null?
When I run this query, it returns null value for ID. The code is supposed to get the max value in the id column.
2013-06-13-0001
2013-06-13-0002
It should get the 2013-06-13-0002 (because of the ...
0
votes
0answers
27 views
Exporting data from SQL Server to multiple Excel files based on query results
I want to create multiple excel files with data from unique query results in SQL server table.
Basically I will be creating 52 excel file with data in it
Query will be :
select * from customers ...
0
votes
2answers
21 views
Update one column from substring of another column
I have an existing column that I would like to take a subset of and insert into a second (new) column in the same table.
e.g. MyTable.[FullName] (existing column) contains a string like "P-13-146 PS ...
0
votes
2answers
27 views
Insert primary key into another table with 2 separate inserts
My code is probably very sloppy and that's probably why I can't get this to work. (Note: I'm using php.) I have 2 inserts on my page and I need to copy the primary key from the first insert and use ...
0
votes
1answer
25 views
SSIS Update a particular column
I have a table in SQL Server with many fields. Two of which are IDNumber and Resolved(Date) Resolved is Null in SQL Server. Then I have data with IDNumber and and Resolved(Date) that I want to import ...
-1
votes
1answer
39 views
Return a row from all tables and all databases?
How would be the SQL SELECT statement for returning a row from all data bases on the server, but just from a specific table and some of the columns of the table.
Or, in pseudo code, something like ...
0
votes
1answer
35 views
Comparing 2 tables with Limited join options
I have this category group , which has 5 categories and Description(Display Text)of the categories . Fields(Category ID, Display Text)
And I have another view which has information about like ...
1
vote
3answers
32 views
SQL Server : Filter Result by CSV String
This one is very tricky...
Products table -> products have multiple colors..
I want a a stored procedure that brings back products WITH certain colors..
For example, a Santa Hat would have "Green" ...
1
vote
2answers
30 views
Get a substring truncated in SQL Server
Question for everyone... I have some values I've inserted into a table as I try to play around with string functions. What I'm trying to do is remove the end of the string and keep everything before ...
0
votes
2answers
38 views
Copying from one “not null” column to another gives a “Cannot insert null value into column.”
I'm currently trying to copy all data from one table to another as the second table is ordered a bit differently I'm using the following SQL script to do so:
USE LoanersTest
DROP TABLE LoanerItems1
...
0
votes
4answers
61 views
SQL rewrite to optimize
I'm trying to optimize or change the SQL to work with inner joins rather than independent calls
Database: one invoice can have many payment records and order (products) records
Original:
SELECT
...
0
votes
1answer
36 views
SQL how to select product where each data has a duration less than 300000 ms
In the following query I am trying to grab upcs where all isrcs have a duration less than 300000 ms where the number of tracks is 11 and where the owning territory is not in 31,201,41,125) with this ...
-2
votes
3answers
54 views
Why join is better than subquery? [closed]
I have read a many of articles that show that join is better than SubQuery.But they did not explain why!
Can you explain to me why join is better than SubQuery?
0
votes
0answers
13 views
Get CHANGETABLE changes for one user
Context:
I'm using SQL Server 2008 and it's CHANGETABLE module to keep multiple databases (SQlite) in sync with the online server running (SQL Server 2008)
Solution Chosen:
I generate queries from ...
-2
votes
0answers
46 views
Delete not deleting and no error message shown
I have a table with a 'for delete' trigger defined on it. All what the trigger does, is to store the deleted rows in another table say TableD.
What I'm experiencing occures when executing a query to ...
0
votes
1answer
28 views
Pivot without aggregate function in MSSQL 2008 R2
Here is a part of my MSSQL 2008 [ERROR CODE] table, which I want to transpose to following structure. I tried searching a workaround but could not find a solution to accomplish the task. Using Pivot I ...
1
vote
1answer
29 views
Error when using left join with my query
My query gives me the following error message:
15:36:08 [SELECT - 0 row(s), 0.000 secs] [Error Code: 102, SQL State: 37000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ...
0
votes
0answers
22 views
SQL Trigger ERROR: OUTPUT clause without INTO clause
I'm getting this error:
The taget table 'Pallet_Movimento_Itens' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.
Code:
...
0
votes
1answer
21 views
Query data for hour by hour report
I've been tasked with a report that will show a bar chart where the X-axis is the hours of the shift, so 1-8 along the bottom. The bars are the number of transactions accomplished per hour. So the bar ...
3
votes
0answers
31 views
High CPU usage on SQL server - Slow queries [migrated]
Our MS SQL Server is using about 95% of the CPU-power.
After a server (hardware) restart, or a SQL-Service restart, the usage is 0% and slowly increases over the course of 1-3 days. Depending on how ...
0
votes
1answer
41 views
Multiple ASP.NET Membership roles in the same Website
In my MVC3 application I have ASP.NET Membership roles like - Manager, System Admin and Editor
I am using Windows Authentication for the website and I am adding the users in the Network to the ...
3
votes
2answers
27 views
Are Columns Not Selected in SQL Views Executed?
I wasn't able to come up with the right keywords to search for the answer for this, so apologies if it was answered already.
Consider the following SQL view:
CREATE VIEW View1 AS
SELECT Column1
...
1
vote
2answers
24 views
MSSQL not matching phone numbers with spaces
I'm trying to write an SQL query for SQL Express that will look up a phone number from the client's database. The issue I'm having is that some of the numbers in the database have spaces in them, but ...
0
votes
1answer
59 views
A query to SELECT a number range
I am having the following problem.
I would like to select a currency value from a database which will act as a default value on the top result of the query (this part is already done and is not a ...
0
votes
2answers
27 views
Unsure as to how to join two working queries together
I have two queries that function perfectly. I'd like to join the two queries together, but I can't figure out how to do this.
I have an SQL Server table structured as follows :
Table name : ...
0
votes
0answers
43 views
ON DELETE CASCADE alternatives and performance (SQL Server)
In my program I store entries in a table and an entry may also have child items.
id uniqueidentifier not null primary key
parent uniqueidentifier null (another id from the same table or null)
... ...
0
votes
2answers
51 views
Query for key value pair structure
I am using SQL Server 2008 R2. I have a table structure as below :
Id (Identity): int
GroupId: int
Field Id: int
Field Name: nvarchar(1000)
Value: nvarchar(max)
This ...
-1
votes
1answer
33 views
How Multiple Joins on Multiple Tables in One Query At SQL Server
I work on a C# project that uses SQL Server.
I want to join on multiple tables in a query (OR run multiple statements in a single query)
My query is this :
(select HR.ID, HR.Cod, HR.CodeValed, ...