Viewing 15 posts - 31 through 45 (of 114 total)
Remember, your CTE is going to go through the entire table to get the row numbers and then again to get them for the previous ID and then again to...
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 11, 2011 at 6:31 am
my query would just show you the next closest value, so you should be all set.
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 10, 2011 at 11:19 am
I'm not sure I follow what you are trying to achieve, but this might be what you are looking for, however it will likely be expensive to run:
select id, sub,...
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 10, 2011 at 5:43 am
There are likely other ways to achieve this, but you can do the following:
Select * from TableName T
where T.Date = Convert(date,getdate())
and T.Time = CONVERT(time,getdate())
You get records where the date and...
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 10, 2011 at 5:36 am
it does mean dynamic SQL. It can be in a stored procedure or the client, but since you searched the database I would say it is definitely the client.
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 9, 2011 at 12:58 pm
you should have an RPC:Completed event (assuming you are tracing it) after your event in question with the same SPID. That is the calling procedure.
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 9, 2011 at 12:43 pm
i defer and agree with gsquared.
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 9, 2011 at 12:15 pm
You will need to pass the output to a table variable. Otherwise the procedure is going to return the contents of the Output operation.
then you can do something like:
if...
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 9, 2011 at 12:03 pm
you need to do the following structure:
DECLARE @TableVariable Table
INSERT INTO
(Field list)
OUTPUT INTO @TableVariable...
SELECT Statement
Then you have the @TableVariable that would contain what you inserted.
Lookup INSERT and OUTPUT in Books...
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 9, 2011 at 10:55 am
couple of items:
1) The insert statement is incomplete....what are you trying to insert?
2) What is IF output inserted.ITEMNMBR ='NULL' ??
3) Is the field ITEMNMBR a null or...
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 9, 2011 at 10:37 am
Excellent idea....and safer. 🙂
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 8, 2011 at 9:14 am
be careful how you remove your PK. If you script it with a drop, dropping a clustered index will delete the table.
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 8, 2011 at 8:56 am
what are the steps of the job? Can you post the SQL being executed?
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 4, 2011 at 8:28 am
Task Manager's I/O number could be misleading without knowing how long the server has been running. What are the specs of SQL Server? Min/Max memory settings. What...
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 4, 2011 at 8:26 am
my original SQL should work for you then.
select Investigation_Id, Case_Id, Investigation_Note, Max(DateTime) MaxDate, Team_Id, Status_Id
from tablename
group by Investigation_Id, Case_Id, Investigation_Note, Team_Id, Status_Id
--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
March 3, 2011 at 11:44 am
Viewing 15 posts - 31 through 45 (of 114 total)