Sunday, August 11, 2013

[SQL Server 2008 issues] SQL to do calc on different rows

[SQL Server 2008 issues] SQL to do calc on different rows


SQL to do calc on different rows

Posted: 10 Aug 2013 05:05 AM PDT

Hi, allIs there any anylytical function in ss so I can achive result like belowo doing calculation on values from different rows? Thanks all for help, I'm sure it should be, I think there is one in oracle ,but I could not find in ss.Thanks allMario[code="other"]select * into #t1 from (select 'alpha' c1, 100 c2 unionselect 'bravo' c1, 120 c2 unionselect 'charlie' c1, 230 c2 unionselect 'delta' c1, 360 c2 unionselect 'whiskey' c1, 500 c2 ) b--delta1 = row2.c2 - row1.c1--delta2 = row2.c3 - row1.c2 etc..c1 | c2 | delta |alpha | 100 | 20 |bravo | 120 | 110 |charlie | 230 | 130 |delta | 360 | 140 |whiskey | 500 | 0 |[/code]

subqueries

Posted: 10 Aug 2013 03:53 PM PDT

hi i have done a subqueries but but it is not displaying any records.select SubjectCode,SubjectName,Descriptionfrom SubjectWhere SubjectCode In(select SubjectCodefrom Absencewhere SubjectCode IN (select SubjectCodefrom AbsenceWhere SubjectCode like 'BS%' and LessonDate = '20130305')); Anyone can help me.

Job hangs when owner is a Windows login

Posted: 09 Aug 2013 10:00 PM PDT

We have a shrink job from maintenance plan. When the owner is sa, job gets completed within 2 min. But if the owner is changed to a windows login, it continue running. Any idea why this happen?I guess, this might be permission issue. The windows account might be permission issue on the drives where the database files are located. Please advice.

Full and transaction log backup chain breakup

Posted: 10 Aug 2013 06:27 AM PDT

Hi ,let us suppose i take full backup f1 and now suppose i take 3 transaction log backup t1,t2,t3 .Now i can restore this transaction log backup provided i had restored full backup f1. But suppose before T3 i take full backup F2 then i cannot restore T3 untill F2 is restored.But why this doesn`t happens in log shipping .I mean in log shipping even if we take full backups and if u have all transaction log backup`s provided there where no breakup`s in log backup`s chain, then to log shipping continues and it doesnt required to apply latest full backup on server(dr server)

What to do when temdb is full ?.

Posted: 10 Aug 2013 03:42 AM PDT

Experts,Tempdb is almost full.No open trans in any of the DBNo blockings.What are things that we need to check and what's the solution. ?Thanks in advance.Smith.

Having problem with memory in sql server

Posted: 10 Aug 2013 05:43 AM PDT

Hi friends at one of our client side we have 4 sql server instances one default and 3 named installed on a single physical server box. It has 32GD ram. 8,8,8,and 4 GB of memory is allocated to sql server.Sometimes memory consumption reaches upto 30/31 gb and i am not able to determine what is eating out memeory.It is not queires because i had use sysprocess and always got random query.Plz help to find out what is consuming memory.Plz tell me where to look for it.what to look for it.which queries/dmvs to use

how to find views from remote servers

Posted: 10 Aug 2013 03:22 AM PDT

Hi all,we had performance trouble with a view from a remote server. A simple change in the CREATE query solved this.My questions are: * is there a way to list all views that use a server in their query?* " " to see which impact each of these view has on server performance?Sorry for my vague questions, I am happy for any hintBest RegardsArthur

No comments:

Post a Comment

Search This Blog