Viewing 15 posts - 541 through 555 (of 670 total)
If you did want to use a pivot table, here's the syntax for that, but it's a little more difficult. Both examples had the same explain plan
Select InsurerID, [January],...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 12:06 pm
not sure why you're using a CTE. You can just use a simple select and group by. One of the issues you're having is because you are gouping...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 11:51 am
You can use a CTE. This assumes that an employee can not exist in a specific load, so that won't count against the totals. See Employee 345. ...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 11:38 am
I assume that en employee could exist in one load and not in the next (lunch break, etc.). If this is the case, then what would the calculation be...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 11:03 am
Is there a way to distinguish the different loads? What do you mean by an employee had 25 seconds, then 30 seconds? Do you have any sample tables...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 10:35 am
You could do a quirky update. Something like this, although I had to add a clustered index on ModelID and ClientID desc to get the update to work. ...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 10:32 am
I think this is what you are looking for
create tables
--===== If the test table already exists, drop it
IF OBJECT_ID('TempDB..#orders','U') IS NOT NULL
DROP TABLE #orders
--===== Create the test table with
CREATE...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 9:42 am
How about table layouts, sample data and expected results?
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 7, 2010 at 8:29 am
just add a where clause to the end of it
declare @Temp TABLE ([DATE] VARCHAR(12), CODE CHAR(1))
INSERT INTO @Temp ([DATE], CODE)
SELECT 'June', 'A' UNION ALL...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 2, 2010 at 6:20 am
Pat,
if you do decide to change the datatype in the tables and you are using SQL Server 2005 or higher, you could try the new datatype vardecimal. This works...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 1, 2010 at 2:09 pm
just a couple of things I noticed. First, it is not very efficient to run the query with the 4-part naming convention. You should investigate using OpenQuery instead....
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 1, 2010 at 1:35 pm
how many actions can a tranid have? why do they have to separated into different columns? how will the table be queried (where action1 = 'ABCD' or action2...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 1, 2010 at 12:30 pm
a pivot table should work for you. Try this
declare @test-2 table(
[tran_id] [nvarchar](14) NULL,
...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 1, 2010 at 12:21 pm
I'll reply on the main thread instead of this one
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 1, 2010 at 12:20 pm
again, I don't know what you are expecting for results. I can keep posting tables of what I think you expect, but if you don't tell me, I can...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
July 1, 2010 at 10:22 am
Viewing 15 posts - 541 through 555 (of 670 total)