Viewing 15 posts - 346 through 360 (of 444 total)
Please correct your INSERT and add what you'd like to see for June in the output. It will help others to understand the problem better.
November 12, 2014 at 5:43 am
To check your @colx variables values, one needs at least assign that values. I see no source of values in the above code, both generating and generated parts. It...
November 12, 2014 at 1:34 am
select 'Nice' as Topic, ':(' as Wording
from Answers
having count (distinct Option) <> count (Option)
November 11, 2014 at 5:54 am
jorgen.olofsson (11/11/2014)
Hi,Is there a simple solution to do this in SQL? 🙂
Thanks!!
BR
Jörgen
Yes, certainly. ROW_NUMBER() + PIVOT
with Event_Table as (
select * from (values
(1, 11, cast('2014-11-11' as date))
,(2, 13, cast('2014-12-10' as...
November 11, 2014 at 3:20 am
Undocumented sp_MSforeachdb can iterate SQL query over databases . For example
EXEC sp_MSforeachdb 'IF ''[?]'' NOT IN (''[master]'',''[model]'',''[msdb]'')
BEGIN
SELECT name,physical_name,state,size
...
November 11, 2014 at 12:57 am
IF NOT (@col1 = '') THEN set @sql = @sql + '[col1] = ' + @col1 + ' '
Should @sql go to SET/SELECT list...
November 10, 2014 at 3:09 am
Noted JOIN often is dramatically faster
select A.*
from A
left join Reference r on A.ReceiptTS > r.ReferenceTS -- single row table
November 7, 2014 at 1:34 am
🙂
“understanding a question is half an answer”
? Socrates
Most probably it will be no any activity updating Staging when the script is running. Otherwise it may end up with some...
November 6, 2014 at 7:29 am
You'd better find more reliable source for scripts. Check this site scripts library
http://www.sqlservercentral.com/search/?q=index+recreate&t=s&sort=relevance
November 6, 2014 at 7:21 am
What about just iterating the update
declare @n int = 1000000;
declare @cnt int = 1;
while @cnt > 0
begin
Update top(@n) Production
Set ReferenceSequence = s.NewSequence
From Production p
join Staging s on...
November 6, 2014 at 6:11 am
nids,
Looks like the problem goes beyond just mastering a query. It's rather system design problem.
May be your site should be more interactive helping user to put his question in...
November 6, 2014 at 4:29 am
Use both methodsto get hole days plus formatted HH:MM:SS
select
CALL_DURATION_IN_SECS
, days = CALL_DURATION_IN_SECS/86400
, time = cast (dateadd(second,CALL_DURATION_IN_SECS,'00:00') as time(0))
from (values
(36),
(2110),
(60),
(10),
(41809),
(24*60*60+1),
(1357),
(3660),
(4),
(5),
(1892),...
November 6, 2014 at 3:20 am
Any chance #md table can be refactored? Type of
create table #MD2(UID int, LA_Type_ID int, LA_Value int);
insert into #MD2 values
(567, 22901,1652)
,(567, 22901,1654)
,(567, 22902,64)
,(567, 22902,67)
Then query will have good...
October 31, 2014 at 2:21 am
OK, if you need it, try
create table #client
(
SiteID int not null,
clientid int not null,
clientnum int not null
);
-- insert into empty #client
with inp as(...
October 30, 2014 at 12:54 pm
Yes, it must be as you've corrected.
You are welcome.
October 30, 2014 at 10:57 am
Viewing 15 posts - 346 through 360 (of 444 total)