Viewing 15 posts - 181 through 195 (of 920 total)
Assuming that the last rownumber for any currentline is the one to be subtracted:
select a.[CurrentLine], a.amount, b.amount, (a.amount - b.amount) as 'total'
from [AmountTable] a join AmountTable b on a.CurrentLine =...
November 20, 2012 at 11:27 am
This is the third thread you've started on this same issue. People, including me, have given you solutions on some threads when you have already been given as good...
November 20, 2012 at 11:15 am
Not very elegant, but... :
declare @timec decimal(6,0)
set @timec = 7
select case when datalength(convert(varchar(6),@timec)) = 1
...
November 20, 2012 at 10:31 am
Once you create the function, it's really not that hard...
declare @dept varchar(200)
set @dept = 'A,B,C'
select item from [DelimitedSplit8K](@dept,',')
item
A
B
C
The article is by Jeff Moden (who had probably forgotten more about this...
November 7, 2012 at 4:45 pm
OK, I'd do it slightly differently. Here's a link to the famous 8k splitter.
http://www.sqlservercentral.com/articles/Tally+Table/72993/
And I'd probably use it like:
drop table #x1
create table #x1
(ano int,
dept varchar(30))
insert into #x1 values(1,'A1,A3,A5,A7')
insert into...
November 7, 2012 at 4:39 pm
And a link to my favorite string splitter. Don't leave home without it...
November 7, 2012 at 3:36 pm
OK,
select ano from #x1 where dept like '%a1%' or dept like '%a5%' or dept like '%a6%'
order by ano
would do it, but I suspect there is more...
Will these 3 conditions be...
November 7, 2012 at 3:27 pm
Tempting to just say:
select ano from #x1 where ano <> 4
order by ano
but there must be some rule involving the 'dept' column in play here. What is the...
November 7, 2012 at 3:05 pm
It's not clear what you're trying to accomplish. Some sample data and sample expected results would help to clear that up. If the mainzip and alternatezip both match...
October 29, 2012 at 4:44 pm
Were these files copied from a SQL Server that was running when the files were copied? If so, they may not be in a state that will allow them...
October 26, 2012 at 9:31 am
OK, this code:
UPDATE T1 SET [September 2012 Billing File] = CASE WHEN T2.[Application ID] IS NOT NULL AND T2.[ServerName]
IS NOT NULL AND [TB Billed This Month] <> 0 THEN...
October 24, 2012 at 4:13 pm
This one says if the tested column is NOT = 0, then it will update with a 'y'. Your post isn't really clear about what the actual results of...
October 24, 2012 at 3:56 pm
What version of SQL Server are you running? You posted this in the SQL Server 2008 forum, so I assumed you were on that version or better.
October 24, 2012 at 2:13 pm
Lowell's is better, just need to add the varchar convert:
select
[active_end_time],
convert(varchar(20),CONVERT(time,STUFF(STUFF(convert(varchar,[active_end_time]),3,0,':'),6,0,':')),100) as val
from [msdb].[dbo].[sysschedules]
October 24, 2012 at 2:12 pm
Viewing 15 posts - 181 through 195 (of 920 total)