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

learn more… | top users | synonyms (2)

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 '%' ...
0
votes
2answers
44 views

SQL Server AlwaysOn from multiple origins to a single secondary replica server

I started working in a small company which have three separate databases, for three different systems. They are SQL Server 2008, 2012 and 2014, installed in different servers. We'd like to set up an ...
1
vote
1answer
101 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
104 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
26 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
66 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
42 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
24 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
216 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
41 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
58 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
58 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
55 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
61 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
72 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
47 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
69 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
59 views

Migrate database from SQL Server 2008 Enterprise to SQL Server 2014 Standard

I need move database with "data compression" from SQL Server 2008 Enterprise to SQL Server 2014 Standard. But Standard edition does not support "data compression". How can I disable "data ...
0
votes
1answer
32 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
21 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
86 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
60 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
24 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
60 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
153 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
62 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
40 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
78 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
252 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: ...
0
votes
1answer
62 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
28 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
57 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 ...
1
vote
0answers
15 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
163 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
174 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
40 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
22 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
33 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?
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
35 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
77 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
492 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
48 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
156 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
31 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
47 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
38 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
70 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 ...