Forum: MS SQL Jul 11th, 2008 |
| Replies: 8 Views: 1,212 Can you give me a little more information about what this particular query is trying to do? You may not need to use UNION, but perhaps different JOINs. |
Forum: MS SQL Jul 11th, 2008 |
| Replies: 5 Views: 1,573 Can you make up some sample data for me? I'll recreate this structure on my server and test it. |
Forum: MS SQL Jul 11th, 2008 |
| Replies: 5 Views: 1,573 Try using != (not equal) instead of NOT LIKE. LIKE is a little more 'fuzzy' than an explicit equal, which is why you did not get the data you were looking for.
Also, one other thing that might... |
Forum: MS SQL Jul 11th, 2008 |
| Replies: 8 Views: 1,212 Try this:
SELECT
hourStamp,
NULL AS ActualVisits,
SUM(CASE WHEN datestamp < GETDATE() THEN 1 ELSE 0 END) / @numberofdays as HourAverage,
SUM(CASE WHEN dateStamp BETWEEN... |
Forum: MS SQL Jul 10th, 2008 |
| Replies: 2 Views: 4,173 If you are using SQL 2005, here's another option. (originally posted in http://www.daniweb.com/forums/post639423-7.html)
Suppose you have a table with the following structure:
id - int... |
Forum: MS SQL Jul 2nd, 2008 |
| Replies: 6 Views: 3,868 Sorry I didn't get this uploaded the other night, the kids have been sick.
Suppose you have a table with the following structure:
id - int PrimaryKey
name - varchar(50)
description -... |
Forum: MS SQL Jun 30th, 2008 |
| Replies: 6 Views: 3,868 The script is on a different computer. I'll post it when I get home. |
Forum: MS SQL Jun 29th, 2008 |
| Replies: 6 Views: 3,868 What version of MSSQL are you using? If 2005, then I have a query you can modify that will remove duplicate entries. |
Forum: MS SQL Mar 25th, 2008 |
| Replies: 3 Views: 2,501 Are you using a cursor?
If so, you could always create a counter variable and increment it each time through the loop. Is this done through an application, or the query window? If it's done in a... |
Forum: MS SQL Mar 24th, 2008 |
| Replies: 1 Views: 1,534 In the Restore Database window, on the Options screen, check the first option 'Overwrite the existing database'.
BTW, are you restoring from a .bak file? Or the .mdf? If you are restoring from... |
Forum: MS SQL Mar 24th, 2008 |
| Replies: 2 Views: 3,609 Not sure if this is what you are looking for:
DECLARE tempCursor CURSOR FOR SELECT col3 FROM table1 WHERE col2 = @col2
OPEN tempCursor
DECLARE @value As int --or whatever your datatype is
... |