Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x

Microsoft SQL Server 2008

49K

Solutions

17K

Contributors

Microsoft SQL Server 2008 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. Major improvements include the  Always On technologies and support for unstructured data types.

Share tech news, updates, or what's on your mind.

Sign up to Post

I had this question after viewing cannot consistently connect to SQL Server named instance.

My situation is slightly different but similar.  I have a default instance (production data) and a named instance (test data) on a SQL Server 2008 R2 installation.  Initially, I was not able to connect locally across my internal network, until I added a firewall rule to open up UDP port 1434 on my SonicWall firewall device.  Now I can access both instances internally without issue.  I have remote users that are using RemoteApp to run my software system off my network and this works perfectly for the default instance.  Whey anyone attempts to access my "test environment" (databases on the named instance), via RemoteApp, they can NOT connect to the databases in the named instance.  This is presenting a problem for me in that my users need to either run demos or perform actual testing using the databases deployed on the named instance.  Does anyone have any suggestions as to what's causing this situation?
0
Free Tool: Site Down Detector
LVL 10
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I have the following SQL Server query.

I was hoping to get help with this on performance.  The most important thing I need it to be able to sort by the 1st column in the order by so that its ascending and does not put nulls first.

I am running this in SQL mode 100 so I cannot use the nulls first or nulls last approach...I also do not seem to be able to get a case to work..

Please help.


SELECT Distinct top 2000 tContact.nid as nID,
iSNULL(tContact.cFirstName, ' ') as cFirstName,
ISNULL(tContact.cMiddleNme, '') as cMiddleNme, 
ISNULL(tContact.cLastName,' ') as cLastName,tContact.cSuffix, tContact.cDepartment, 
tContact.cTitle, tContact.cEmail as cEmail,tContact.cEmailAlt, tContact.lActive, 
 tContact.cClassify, tContact.cDesignate, tContact.cContactCompany,
 tContact.cPhone, tContact.cPhoneExt,tContact.cCellPhone,tContact.cHomePhone, ISNULL(tContact.cEIN,' ') AS cEIN,
 tSubscr.nid as nidSubscr, tSubscr.cUserID, tSubscr.lActive as lActiveSubscr, tSubscr.lAdmin as lAdminSubscr, tSubscr.dLastLogin, 
 (select cPhone1 from CADoc_CRM..tClient where nID = tContact.nIDClient) as cClientPhone, 
 Case When dupes.nIdContact is null Then cast(0 as bit) Else cast(1 as bit) End as lContactIsDuplicated, 
 Case When coalesce(changeRequest.status,1) = 0 Then Cast(1 as bit) Else Cast(0 as bit) End as lChangeRequestPending 

 FROM CADoc_CRM..tContact tContact 
 left outer join CADoc_System..tSubscrXCRMCont tSXCC on tSXCC.cIdCRMCont = tContact.nid 
 left outer join 

Open in new window

0
Hi,

We have already existing maintenance plan (Full Db backup).
now i want automate like, any newly created DB should automatically added to existing maintenance plan?
how to do this?
0
Below is an example of a SQL statement I'm using.  The date is actually "2017-10-27 17:10:12.000" but no data is returned.  If I use >= I do receive a record.  Why is the > not returning data?
SELECT F1 
FROM Table1
WHERE RequiredDate = '10/27/17'

Open in new window

0
Hi there,
    we have a requirement where the non sysadmin user accounts shouldn't access (ie., select data)  from any system views or tables of master database.

This requirement is a part of security enhancement needs and we are using sql server 2008 R2 Enterprise edition.

thanks
Deepak
0
How to I copy database files or tables from one sql server 2008 to another same version.
0
Can you please tell me how to fix that error?
screenshot.png
0
I have 2008 sql server but it doens't have the management studio with it. How to I install it?
screenshot.png
0
i'm using sql server 2008

SELECT [OrderID]
      ,[CustomerID]
      ,[EmployeeID]
FROM [Northwind].[dbo].[Orders]
ORDER BY [CustomerID]

This is the Orders table

p1.PNG
I want to use the COUNT(*) function to get the count of Orders for each CustomerID.

How do I get the Count of orders for each CustomerID.

The result returned from the query should look lik this.
The first column would be the CustomerID and then the second column would be the count of Orders that customer had.
So then for example in the image below. ALFKI had 6 orders, ANATR 4 orders and so forth.

p2.PNG
0
I'm using sql server 2008.

I have a stored procedure that returns a column that is Bit dataype called [CurrentlyEmployed]

I'm filtering like this

WHERE   [CurrentlyEmployed] = @EmployeeStatus]


When I feed @EmployeeStatus = 1 to my stored procedure it returns all the employees that are currently employed
When I feed @EmployeeStatus = 0 to my stored procedure it returns all the employees that are not currently employed

How do i revise my were clause to return "All Employees".?
So this is all employees that are currently employed and also the ones not employed.
0
Enroll in October's Free Course of the Month
LVL 10
Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

DECLARE 
	
	@PartsOutputTbl TABLE (ID INT)
 
	insert into Parts(CustID, PartNumber, [Description], TypeID, UMID, StatusID, Notes, PackageReqID, AllowCrossesID, RoHS, CommonStock, NumberOfLeads, ClassID, HasSafetyStock, ReorderQnty) 
	OUTPUT inserted.PartID INTO @PartsOutputTbl(ID)
	values ('', @PartsPartNumber, @PartDescription, @PartsTypeID, @PartsUM, @PartsStatus, @PartsNotes, 0, @PartsAllowCrosses, @PartsRoHS, 0, @PartNoLeads, @PartsClassID, 0, 0)

Open in new window


But how do I do this:

DECLARE 
	
	@PartsOutputTbl TABLE (ID INT)

@ANOTHEROutputTbl TABLE (ID INT)
 
	insert into Parts(CustID, PartNumber, [Description], TypeID, UMID, StatusID, Notes, PackageReqID, AllowCrossesID, RoHS, CommonStock, NumberOfLeads, ClassID, HasSafetyStock, ReorderQnty) 
	OUTPUT inserted.PartID INTO @PartsOutputTbl(ID)
	values ('', @PartsPartNumber, @PartDescription, @PartsTypeID, @PartsUM, @PartsStatus, @PartsNotes, 0, @PartsAllowCrosses, @PartsRoHS, 0, @PartNoLeads, @PartsClassID, 0, 0)


-- do another insert using @ANOTHEROutputTbl

Open in new window


My question is proper syntax to declare multiple tables:

DECLARE 
	
	@PartsOutputTbl TABLE (ID INT),  -- cannot use comma

@ANOTHEROutputTbl TABLE (ID INT)

Open in new window


Gives an error:

expected
0
In the select below...
Can I use a coalesce or stuff xml statement to get a comma separated column of i.IndividualID's?


SELECT   o.OriginName ,
         COUNT(*) Cnt ,
         MAX(i.DateAdded) MaxDateAdded ,
         GETDATE() AS currDate
FROM     Individuals i
         JOIN IndividualOrigins oo ON i.IndividualID = oo.IndividualID
         JOIN Origins o ON oo.OriginID = o.OriginID
WHERE    o.OriginName IN ( 'BGV LEADS', 'BGV OWNERS' )
         AND DATEDIFF(HH, i.DateModified, GETDATE()) <= 12
GROUP BY o.OriginName
HAVING   COUNT(i.IndividualID) > 0;

Open in new window

0
I am confused about what this gets me MCP status or just half way to MCSE?

I am seeing contradictions  and have a slow internet and it is hard to search and find this answer

https://www.microsoft.com/en-us/learning/exam-70-534.aspx
0
We have an install of SQL Server 2008 R2 Standard SP1 on a Server 2008 R2 install.  The max memory for Server 2008 R2 is 32GB and the max memory for SQL Server 2008 R2 Standard is 64GB.  If we installed a total of 64GB of RAM on Server 2008 R2, would SQL be able to use the additional 32GB or would it still be maxed out at the 32GB the OS sees?  I can't seem to find a definitive answer as to if SQL can use memory not being used by the OS.  Thanks for any help you can give.
0
I have mssql 2012 server
I want to know if dividing tempdb is necessary step if I have 8 or 10 cores. I've heard some argument dividing tempdb is not necessary, especially in latest SQL server version.

Can you share your professional opinions? what is the benefits or negative...etc for dividing or not dividing tempdb?
0
How to i restore files in SQL Server 2008? I am using windows 7.
screenshot.pngscreenshot2.png
0
Hi Experts,

I have this query:

Declare
 @REPORTTYPE as varchar(50),
 @POLICY as varchar(2000)

DECLARE @DB_REPORTTYPE as varchar(50)
SET @DB_REPORTTYPE = @REPORTTYPE
DECLARE @DB_POLICY as varchar(2000)
SET @DB_POLICY = @POLICY--'1 Draft VA SQL Server 2012 Policy (2)'

SELECT
	'Please fix to only one' as NeedBothAdded,
	--BOWN.[Branch Region],
	--BOWN.[Branch Network],
	--BOWN.Branch, 
	(Cast(SUM( Case when ActionableResult = 1 THEN 1 ELSE 0 END ) as int)) as [Fail],
	(Cast(SUM( Case when ActionableResult = 0 THEN 1 ELSE 0 END ) as int)) as [Pass],
	Count(*) as [All], 
	(Cast( SUM( Case when ActionableResult = 1 THEN 1 ELSE 0 END)  as float) /Count(*)) as PercentFailed,
	(Cast( SUM( Case when ActionableResult = 0 THEN 1 ELSE 0 END)  as float) /Count(*)) as PercentCompliant,
	Case when ActionableResult = 1 THEN 'No' ELSE 'Yes' END  as Success,
	fac.ComplianceAssetKey,
	fac.OwnershipGroupKey,
	fac.ScanPolicyGroupKey 
	--fac.AssetHostName
	--fac.[CheckName]

FROM [dw].[FactComplianceAssetCheck] as fac 
  inner join dw.brgComplianceScanPolicy as BCP on BCP.ScanPolicyGroupKey = fac.ScanPolicyGroupKey                                   
  inner join [dw].[brgOwnership] as BOWN on BOWN.[OwnershipGroupKey] = fac.OwnershipGroupKey
  inner Join dw.DimComplianceAsset CA On CA.ComplianceAssetKey = Fac.ComplianceAssetKey 
  WHERE fac.IsRowCurrent = 1 
  and Left(BCP.PolicyName, 72) = @DB_POLICY -- Note: Policy name had to be truncated by 72 for the dropdown otherwise way too 

Open in new window

0
What do you think are some best tools that can be useful for data analyst?
0
How many user defined tables can be created in MS SQL Server 2008 and above versions?
0
NFR key for Veeam Agent for Linux
LVL 1
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Hello guys

How could I create a user for my database as administrator, the same privileges as 'sa'

thanks
0
Hello guys,

I am not having success with my store proc to create database, I think the problem is syntax. Could you take a look at it and help me on this task?


the code:

create procedure Start_NovaEstruturaDB( @userID varchar(10), @userName varchar(50) )
as
 declare @NomeBanco varchar(100);
 declare @NomeBancoLog varchar(100);
 declare @CaminhoBanco varchar(200);

 Set @NomeBanco    = 'SAAS_' + @userID + '_HERMES_' + @userName;
 Set @NomeBancoLog = 'SAAS_' + @userID + '_HERMES_' + @userName + '_LOG.LDF';
 Set @CaminhoBanco = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\BACKUP\';
                     

 if not exists (select * from Master..sysdatabases where Name = @NomeBanco) begin
    exec ' create database ' + @NomeBanco + ' on primary(NAME = ' + @NomeBanco + ',' + 
                ' filename = ' + @CaminhoBanco + @NomeBanco +'.MDF,' + 
                ' size = 100, filegrowth = 20) ' +      
                '  LOG on (NAME = '+ @NomeBanco + ',' 
                ' filename = ' + @CaminhoBanco + @NomeBancoLog + ', size = 100, filegrowth = 15%);'


      
      exec sp_dboption @NomeBanco, 'trunc. log on chkpt' , 'on';      
      exec sp_dboption @NomeBanco, 'select into/bulkcopy', 'on';
      exec sp_dboption @NomeBanco, 'ANSI null default'   , 'on';
      exec sp_dboption @NomeBanco, 'autoshrink'          , 'on';  
 end;

Open in new window


thanks
alexandre
0
Hi experts, I'm trying to rename one of my tables but the solution below didn't work. When I execute it an error meassage says; "Incorrect syntax near the keyword 'TABLE'." I'm using Sql 8. Any help please!


RENAME TABLE Personnel TO newPersonnel
0
Is it possible to schedule a job to run every hour, but at a specific time every hour?

For example, i would want to run the job at 1:02, 2:02, 3:02, 4:02 etc...

Right now, the SQL scheduler wizard only allows me to select the top of every hour for a specific time-frame.
0
I am looking for idea. I need to grab locations , some of the lcoations have the same name but different locationID.

I need to create a location drop down with a unique locations. And then do the search by these locations. The question  is if I do make a drop down of unique locations thne in my search I will be searching by name instead of locationID
0
I have a question related to OLE Automation (reference: Why not enable 'OLE Automation Procedures' )

I need to use OLE Automation to interact with the Windows File System.  I do not want to leave OLE Automation "turned on" because of Security Risks so......

Is there a way to turn OLE Automation On at the beginning of a Stored Procedure and then turn it back off at the end of the procedure?   The Procedure will run on a timed cycle from a SQL Agent job.

Thanks in advance!
0

Microsoft SQL Server 2008

49K

Solutions

17K

Contributors

Microsoft SQL Server 2008 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. Major improvements include the  Always On technologies and support for unstructured data types.