Saturday, August 17, 2013

[SQL 2012] Get Totals from a Query

[SQL 2012] Get Totals from a Query


Get Totals from a Query

Posted: 17 Aug 2013 03:24 AM PDT

HiI have a query that returns all the records that match my criteria.However how do I get a count of sub-sets of this result.For example....I need to the total of all company execs where CON.AccountIdName = 'Company1 Name'etc. etc.[code]DECLARE @iCompany1Execs INTEGER DECLARE @iCompany2Execs INTEGER DECLARE @iCompany3Execs INTEGERDECLARE @iCompany4Execs INTEGERDECLARE @iCompany5Execs INTEGERDECLARE @iCompany1Total INTEGERDECLARE @iCompany2Total INTEGERDECLARE @iCompany3Total INTEGERDECLARE @iCompany4Total INTEGERDECLARE @iCompany5Total INTEGERDECLARE @iTotalAllRecs INTEGER SELECT CON.new_MembershipNumber AS 'Member ID' , CON.AccountIdName AS 'Company' , STG.Value AS 'Membership Type' , CON.FirstName AS 'First Name' , CON.LastName AS 'Last Name' FROM dbo.Contact CONLEFT OUTER JOIN StringMap STG ON STG.attributename = 'new_membertype' AND STG.attributevalue = CON.new_MemberType AND STG.objecttypecode = 2 AND STG.langid = 1033WHERE CON.StatusCode = 1[/code]

Sql Server 2012 LocalDb deployment

Posted: 21 Dec 2012 05:30 AM PST

I have researched the Internet but cannot get a complete answer or instructions. I have seen this asked in a few other forums. What is the deployment process for LocalDb as part of an application package. I thought I read somewhere that some LocalDb binary files need to be deployed. Any assistance would be appreciated. TIA

SQL Server Service stopped and won't start

Posted: 16 Aug 2013 11:00 AM PDT

I've installed SQL Server 2012 on the same machine as my SQL Server 2008 default instance, and it's named SQLSERVER2012. Install went fine; chose default settings for everything possible, and installed every single possible feature. SQL Server 2008 Service is running fine, but SQSERVER2012 service isn't.I have tried to start the service using each of the available built in logon accounts (Local Service, Network Service, Local System) and also Admin account, but after clicking start I see SQL Server Configuration manager progress bar moving all the way to the right and just before completing failing with error message:"The request failed or the service did not respond in a timely fashion, Consult the event log or other applicable logs". I did consult the SQL Server Log -- no entries. I also went to Windows Event Log/Event Viewer/Windows Logs/Application and it shows an error occurred in the last hour but no Event ID and no Application listed."Will someone advise with next steps? I still have DVD for reinstalling evaluation version of SQL Server 2012 and worse comes to worse, I can uninstall and reinstall it.

No comments:

Post a Comment

Search This Blog