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

learn more… | top users | synonyms (2)

3
votes
1answer
175 views

SQL to Find Partial Duplicates of a Field

I have a table with a field for a member number. The table can contain records with duplicate values for this field and does. I have a SQL query that will obtain any duplicate values for this field, ...
0
votes
0answers
43 views

Rowlock hint is doing Lock escalation at table level. i dont know why.? [closed]

I want to first do select to read rows and then do some calculations and then finally update the read row. So my transaction will be in 3 steps: select the records (In this session only allow other ...
1
vote
0answers
45 views

Window function vs group by method: find value for MAX ID

I'm trying to understand the performance issue with Window function when i select value for MAX ID --Old group By method SELECT tj.MainProcedure , tj.StartTime , tj.EndTime , ...
0
votes
0answers
31 views

Do both the sessions need to have UPDLOCK to avoid deadlocks

The benifit of UPDLOCK is that it avoids deadlock in case both sessions run the below query at the same time - The table has clustered index on ID column ----session 1 -------- begin transaction ...
0
votes
0answers
32 views

SQL Server: Update linked table times out

I have 4 linked SQL Server 2008 R2 servers in the same network, and distributed selection queries works fine. However when I try to run something like that: UPDATE [LINKED SERVER NAME].[DB ...
1
vote
1answer
55 views

Setting up SQL Server to handle queries from external domains

I am not a SQL Server admin. I have tried to google this but can't seem to use the right words to get the right info and they all talk about remote connections to a SQL Server in terms of admin and ...
3
votes
1answer
115 views

Determine Which Parameters Passed Into Stored Procedure

Is there a way to determine (from within a stored procedure) which parameters were passed into a stored procedure (vs. those which just took the default value)?
15
votes
2answers
2k views

Why does SQL Injection not happen on this query inside a stored procedure?

I made the following stored procedure: ALTER PROCEDURE usp_actorBirthdays (@nameString nvarchar(100), @actorgender nvarchar(100)) AS SELECT ActorDOB, ActorName FROM tblActor WHERE ActorName LIKE '%' ...
1
vote
1answer
125 views

How to get SQL Server CPU and Memory read and write usage within two weeks?

Is there any a quick way or quick script on how to get the CPU and Memory usage within a time range (at least two weeks)? I did my research earlier and it seems that the procedures available seems ...
4
votes
1answer
106 views

Viewing Temp Tables

I am using SQL Server 2008 and my stored proceduce does inserts into #temptable. My procedure has been running for 32 hours (which isn't unheard of considering the amount of data that it has to ...
-1
votes
2answers
27 views

how do i take the end value of a colum, convert to date and insert into a new column

I have a column [week] in a table [wkd] with a value of 11/08 - 11/14. They are strings with 2 date ranges. (nov 8 - nov 14). what I need to do is get 11/14 into a new date column [weekending] so ...
2
votes
1answer
69 views

looking for a cleaner way to select from multiple tables

I'm currently using this code to select from 2 tables using a stored procedure. DECLARE @now as varchar(26) set @now = CONVERT(VARCHAR(26), SYSDATETIME(), 9) --Select 'SMD_' + ...
1
vote
1answer
73 views

Aggregate SQL Rows into single column

I would like to aggregate results of a column into a single row using MS SQL. I have create a sql fiddle which showcases the issue: http://sqlfiddle.com/#!3/384d5/2 Basically I would like all 'Tag' ...
1
vote
1answer
25 views

SQL Server 2008 job failure

I have a problem on my servers sitting on different domains. I created a linked server that executes successfully and I can list the catalogue but when I schedule a job to execute I get this error: ...
0
votes
2answers
566 views

How to restore a database using mdf and ldf files in SQL Server 2008?

Asking for expert opinion. A very unfortunate event happened. One of our PCs crashed few days ago. That PC had SQL Server 2008 installed. Unfortunately no backup was running on that server. We sent ...
0
votes
0answers
50 views

Issue with multiple execution of sys.sp_addextendedproperty

I'm using SQL Server 2008 R2. I need to store a text as a description of each table of my DB. But I don't want to do this with wizard. I handled to build some code for this purpose. Here's a part of ...
0
votes
1answer
134 views

How to deny drop, delete permission for a table?

I want to give Create , alter , read permission on object to user but not insert , update ,delete,drop permission to user , How can i do it in sql server 2008?
1
vote
0answers
19 views

What is the most effective way to manage a community table with one customizable flag?

Fair warning I do not have dba training or anything of the like but I am managing a rather large web app database. I know the basics but I'm not sure how to handle this latest scenario. Setup I ...
1
vote
3answers
89 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
62 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
72 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
87 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
53 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
104 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
39 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
27 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
97 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
144 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
63 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
311 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
70 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
59 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
82 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
434 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
84 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
32 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
106 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
32 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
358 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
234 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
63 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
105 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
863 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 ...