Viewing 15 posts - 54,601 through 54,615 (of 59,072 total)
CASE WHEN a.col1 = b.col1 THEN 1 ELSE 0 END
+ CASE WHEN a.col2 = b.col2 THEN 1 ELSE 0 END
+ CASE WHEN a.col3 = b.col3 THEN 1 ELSE 0 END
+...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 4:27 pm
Sure...
[font="Courier New"]--===== This is just to build some sample data and is NOT part of the solution
DECLARE @yourtable TABLE (FromUser VARCHAR(10), ToUser VARCHAR(10))
 INSERT INTO @yourtable (FromUser, ToUser)
 SELECT 'user1','user2' UNION ALL
 SELECT 'user2','user1' UNION ALL
 SELECT 'user1','user2' UNION ALL
 SELECT 'user1','user3' UNION ALL
 SELECT 'user3','user1'
--===== This is the solution
 SELECT d.FromUser, d.ToUser, COUNT(*) AS TimeConnected
   FROM (--==== Derived table swaps users when needed
         SELECT FromUser, ToUser
           FROM @yourtable
          WHERE FromUser < ToUser
          UNION ALL
         SELECT ToUser AS FromUser,
                FromUser AS ToUser
           FROM @yourtable
          WHERE ToUser <= FromUser
        ) d
  GROUP BY d.FromUser, d.ToUser[/font]
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 4:17 pm
SQL Server has a LEFT and a RIGHT... no need to build a special function to do it as bad as Oracle 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 4:04 pm
Sure... A thing called "Books Online" should become your best friend. One way of getting to it is to open Query Analyzer, click on the [Help] button, and select...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 4:00 pm
You bet... thank you for the feedback...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 11:59 am
Could be any of a dozen different problems... you need to post the code you're using and the CREATE statement for the table you are importing to.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 10:56 am
Grant, I'm with you... I see no compelling reason for CLR's. My opinion, for the most part, for them being there is the same as DTS and Cursors... they...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 10:54 am
The easiest way to split limited (up to 4 parts) period-delimited text of this nature is to use PARSENAME. Look it up in Books Online for a full explanation.
Here's...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 10:32 am
This is very nearly a duplicate post...
http://www.sqlservercentral.com/Forums/Topic410280-65-1.aspx
The only thing that means anything about performance for all the timers you have here is this...
Number of TDS packets received 28569 28569
Number of...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 10:20 am
That information is available in Books Online ("Transact-SQL Help" under Help button in Query Analyzer). Lookup "Execution Plan pane" in the index...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 10:13 am
If you're asking how long we think it should take for you to process the 1.7 million rows that your are... we have no clue because we don't know what...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 10:10 am
SELECT *
FROM yourtable
WHERE Address1 LIKE '[0-9]%'
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 10:03 am
You could have also used TRUNCATE table which resets the ID column back to 1.
But, even that doesn't "Fix" it... why are you using a cursor? Perhaps if you...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 13, 2007 at 9:50 am
NEWID() won't guarantee it... it's only guaranteed at the full 32 characters.
What's wrong with this?
SELECT CAST(CAST(0x0013020061675035 AS BIGINT)+1 AS VARBINARY)
If you find the largest item in the column, just add...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 12, 2007 at 10:20 pm
I only see the column names being returned... no data types...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 12, 2007 at 10:04 pm
Viewing 15 posts - 54,601 through 54,615 (of 59,072 total)