SQL Server 2008 (major build version 10.00.xxxx). Please also tag with sql-server.

learn more… | top users | synonyms (2)

1
vote
3answers
78 views

dynamically get last x months and output as a format

Using today's date, I need to be able to go back x months and output in the format of YYYY_MM At the moment, I am using: select right('0000' + cast(datepart(year, getdate()) as varchar(4)), 4) + ...
0
votes
3answers
61 views

Connecting to a SQL server whose IP changes

I want to connect to a server whose IP is dynamic via a VB.net application. I have configured the connection string in my VB application to a static IP. I also gave a static IP to the database. ...
0
votes
0answers
68 views

Help diagnosing a single-table, single row deadlock

We're currently using an ORM-controlled, table-based, identity generation scheme to generate the IDs for our entities. The table is as follows: create table id_seq ( tbl varchar(255) not null, id ...
2
votes
1answer
80 views

Are there undocumented Linked Server limitations?

I'm working on a SQL Server 2008 R2 SP1 with a Sage product registered as a linked server. There are a few stored procedures that execute a pass-through against the linked server. Once in a while, a ...
0
votes
1answer
51 views

Finding Deleted / Updated record statement from SQL Server transaction Log backup file

One of my production server's data was updated / deleted by someone. I want to find out when the data was deleted or updated, and if it's updated/ deleted then through which statement it was updated ...
1
vote
0answers
93 views

Backing up / restoring a 20GB database with images stored as binary code

Please excuse me as I am a beginner. I am trying to backup and restore a 20GB database from a SQL Server 2012 to another SQL Server 2014, but I have come across the following issues: The developers ...
0
votes
1answer
37 views

Better parallelization than a sequence container in SSIS 2008?

We currently have a process that has to process hundreds of thousands of rows an hour. For valid reasons, it has to call a stored procedure for each row. We're using a SSIS package (SQL Server 2008) ...
0
votes
1answer
26 views

Filter Data to different data files on SQL server

I'm sure this is possible but I have no idea how or where to find the information on how to do it. Scenario: I have a reporting database (on SQL2008R2) which is split up into multiple file groups ...
0
votes
1answer
94 views

Query running super slow on a specific date [closed]

I have the following SQL Query I'm executing on a MSSQL2008 DB: SELECT O.OrderDate AS [Date], O.OrderID AS [Order No], DC.DiscountCouponCode AS [Discount ...
-3
votes
1answer
120 views

Generate Script Of Database in SQL Server 2008 [closed]

How to Create Script for the Database Objects in SQL server 2008 r2 and restore it in database.
1
vote
0answers
25 views

Index comparison

On my Production server (SQL2008) I have a query that returns suggestions of indexes. SELECT * FROM sys.dm_db_missing_index_groups g INNER JOIN sys.dm_db_missing_index_group_stats gs on ...
0
votes
2answers
62 views

How do I get column name from a SQL statement?

Is there any easy way just to get the column names returned from a SQL statement ? Such as: SELECT * FROM ATable FULL OUTER JOIN BTable b ON a.SOME_KEY = b.SOME_KEY FULL OUTER JOIN CTable c ...
1
vote
2answers
276 views

Security update failed : The baseline msi is not installed

Yesterday we had to apply a security update for SQL Server 2008 SP4( Current version: 10.0.6000.29) (from KB3045311 and MS15-058) and it failed in both the nodes of a Windows failover cluster and both ...
5
votes
2answers
68 views

SQL Server - Stopping a server side trace

I want to setup a server side replay trace and scripted out setting up the trace. However I want the trace to end either after 12 hours or once 10 1GB files have been created. Normally with a max file ...
1
vote
1answer
52 views

SSIS Merge component performing a UNION instead of merging

I have a package to combine data from multiple databases. I'm trying to bring together two data sets so they can be written to a single table. There's a common SSIS_ID (DT_I4) used to match rows and ...
-1
votes
1answer
81 views

How do you translate this into SQL Server 2008 statement?

I'm not sure how to translate this from Access to SQL. We are currently using SQL Server 2008. I am trying to migrate Access reports into SQL views. SELECT ...
1
vote
1answer
380 views

Cannot run Sql Server Agent jobs with PowerShell script

The problem: I have a customer that cannot run Sql Server Agent jobs with PowerShell script. It fails with this message: Message Executed as user: xxNC\SQLService. Unhandled Exception: ...
1
vote
1answer
82 views

What is better to use for this case, a CTE or a table variable?

I sometimes need to write t-SQL code to send emails per row based on some conditional checks on some tables. So because the original table does not have an identity or some such column to track rows, ...
-3
votes
0answers
24 views

I need the results of 7 day period and sum all point according to 7 day [duplicate]

USE [MLMDB] GO /****** Object: Table [dbo].[payoutPoints] Script Date: 10/15/2015 16:58:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE ...
0
votes
1answer
31 views

Change SSIS package location (REPOST from SO) [closed]

My SSIS Package are located in shared drive with a long path name. To make the packages easier and not to remember long path name, I use "Map my network drive" option and use X: drive as an alias to ...
0
votes
1answer
91 views

MS SQL Server 2008 makes hard disk space disappear

We are running SharePoint 2010 with MS SQL Server 2008 (Windows Server 2008 R2 Enterprise). We have not taken regular SP backups this far which has led to high disk usage. However, even if I shrink ...
0
votes
0answers
30 views

Change SSIS package location

My SSIS Package are located in shared drive with a long path name. To make the packages easier and not to remember long path name, I use "Map my network drive" option and use X: drive as an alias to ...
-1
votes
3answers
296 views

SQL Server installation errors assembly

I have been trying to install SQL Server and now I am tired of it. I tried to version SQL Server 2008 and SQL Server 2008 R2. SQL Server 2008 gives the following error (.Net Framework installed) ...
3
votes
2answers
211 views

What would be the most efficient way to check for null values in all columns for multiple tables?

Say I have three tables or four tables that I want to check for values present and I don't want any of them to be null. IF they are null, I will send an email notification per row. What would be the ...
0
votes
1answer
58 views

dm_db_index_physical_stats results inconsistent with actual object properties - what may be the reasons?

SQL Server 2008 RTM (10.0.1600.22) Running a typical index fragmentation report on a table: SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName, i.name AS IndexName, s.index_type_desc, ...
0
votes
0answers
25 views

Service Broker -

SQL 2008 R2, clustered and mirrored. We recently switched data centers, and Service Broker is now failing to receive messages sent from another instance on the same cluster. This was working for the ...
-3
votes
1answer
34 views

Without Quorum Drive.. will it work node1 and node2 in cluster [closed]

Without Quorum Drive.. will it work node1 and node2 in cluster. How it is possible? if not required then where it stores cluster information?
11
votes
5answers
2k views

Backing up & restoring 10-20 SQL Server databases to a ~synchronous state?

I need to backup up 10-20 SQL Server 2008 R2 databases with sizes between 10-50 GB, while they are online and used simultaneously by a single enterprise app. I also need to restore them to a state ...
0
votes
2answers
49 views

What is the difference between these 2 queries?

We have these 2 queries: select jsh.jobid, max(jsh.Audit_CreatedDate) from JobStatusHistories jsh join Jobs j on j.JobId = jsh.JobId where j.JobStatusId = 11 and jsh.Audit_CreatedBy <> ...
1
vote
1answer
37 views

Find results based on other results [closed]

In SQL Server 2008, I have a table called Info.Case, which lists all the cases we have, Info.Person which lists all the people in the database, and a table called Links.Case_Person, which lists how ...
1
vote
1answer
97 views

Task generated T-SQL shows unknown property IsMemoryOptimized

I have modified a Maintenance plan on SQL Server 2008 using SSMS 2014, particularly Reorganize index task - I have added another two databases for this task. When I wanted to check if the T-SQL is ...
10
votes
2answers
759 views

What's the best method to refresh only a few tables within a test database from production?

I have a very large production database and a very large test environment database in SQL Server 2008R2. Both databases have similar table structure but different users/logins/permissions/roles. I ...
0
votes
0answers
56 views

Slow query performance - aritmethic operators, not exists, subselects

In our application we have this query that takes A LOT of time to execute, considering that is frequently used (> 20 seconds). We use Hibernate as our ORM. All the tables have a clustered primary ...
4
votes
4answers
242 views

Migrating Large Database from SQL Server 2008 to 2014

I currently have on a large database (~500GB) on SQL Server 2008 that is going to be relocated to a new SQL Server 2014 server. My aim is to keep migration time down to a minimum. Migrating the ...
1
vote
1answer
33 views

Batch process to delete table from SQL Server backup files

I have a set of full backups from a same SQL Server database saved in different files. For example: 01.my-database.bak 02.my-database.bak 03.my-database.bak I want to delete a specific table from ...
-2
votes
1answer
50 views

Restored database smaller than the backup file [closed]

The new database created from a restore file is half the size of the backup file I restored from. Why? Original backup settings: Recovery Model: SIMPLE Backup Type: FULL
0
votes
0answers
58 views

ORM and performance for SQL Servers

In a past SQLBits, one of the speakers went into some detail about ORM software's effect on SQL Server performance. The example the speaker was referring to was one in which the application was ...
1
vote
1answer
86 views

Is my mssql 2008 standard suitable for web edition 2014

A web edition seems enough for me when I read this. I thought it had a 2gb size limit before? I have three databases our current db and am not doing anything fancy. Just some server agent jobs from ...
0
votes
1answer
35 views

Syncing Database to Application (polling)

I have created a windows application that uses a MS SQL 2008 database server. There are two types of the application: 1) Client Application 2) Host Application The client application is able to ...
-1
votes
1answer
168 views

Issues after applying Sql 2008 sp4, 'sqlagent100_msdb_upgrade.sql'

The build version was 2008Std.2531 went to apply SP4 and the upgrade would not complete preventing the engine to come on line. After some assistance and using the -t902 the engine is up but the SP is ...
0
votes
0answers
47 views

FreeTds with 2 sql server instances

I have python scripts on a Linux machine that connect to Microsoft sql server to get data. The server was initially 2008 version. Now it has both 2008 and 2012. How can I point the tds to connect ...
4
votes
1answer
111 views

Scenario of huge SQL Server Database backup

I use SQL Server and have a huge database with large compressed backup size (about 250 GB). The backup scenario of this database is: Create full backup at the first day of each month. Create ...
8
votes
2answers
122 views

SQL Server equivalent of Oracle USING INDEX clause

Is there a SQL Server 2008 equivalent of the USING INDEX clause in Oracle? Specifically for the construct: CREATE TABLE c(c1 INT, c2 INT); CREATE INDEX ci ON c (c1, c2); ALTER TABLE c ADD CONSTRAINT ...
0
votes
1answer
34 views

Create Table error [closed]

I am using Microsoft SQL Server 2008. My version of Server Management Studio is 2014. I am attempting to create a table in a database I imported from a Microsoft SQL Server 2005. Here is my code: ...
1
vote
3answers
74 views

Why is Convert being used in this statement and how does it differ from CAST?

This is a piece of code on MSDN page for OVER clause: USE AdventureWorks2012; GO SELECT BusinessEntityID, TerritoryID ,DATEPART(yy,ModifiedDate) AS SalesYear ,CONVERT(varchar(20),SalesYTD,1) AS ...
0
votes
0answers
24 views

Aggregate SQL function question [duplicate]

Simple question Table "state" sID | state_descr | doorID | time 1 | open | 1 |2015-05-01 00:00:01 2 | open | 2 |2015-05-01 00:00:02 3 | close | 1 ...
1
vote
2answers
27 views

Restore Database or Restore Files?

I am copying a database from a live environment to test environment. I've made a .bak file from the live database and copied the file to the test server. Question is, should I use "Restore Database" ...
0
votes
2answers
198 views

Restore DB from SQL Server 2008 R2 to 2014 Express

I'm trying to restore a database backup made in SQL Server 2008 R2 to the 2014 Express version. Is this even possible? If I choose restore from device and select my backup file, I see no database in ...
2
votes
3answers
514 views

Student who got MAX marks in subject

I am facing one issue in getting student name who scored MAX marks in each subject. Here are my tables below First one is Student table having STUD_ID , STUD_NAME & Second one is MARKS ...
1
vote
2answers
229 views

How do I sum data over 3 month ranges?

I have a report where I need to add totals for a column and group them by company selected. I have to do this in T-SQL for 4 ranges: 0-3 Months, 3-6 months, 6-12 months, >12 months I am confused about ...