Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
0answers
8 views

What are implications for changing encryption from TRIPLE_DES to AES_128?

As title asks, what are implications for changing encryption from TRIPLE_DES to AES_128? I have an older database I've been tasked with hardening, and I need to updated the algorithm used for ...
0
votes
0answers
31 views

How to determine memory requirement for new SQL Server Instance for certain application? [on hold]

There is going to be a new installation of SQL Server Instance for a certain application, and the client is asking for how much memory to be allocated to the new system. On what basis should I be ...
4
votes
2answers
136 views

The disappearing act of the “Invalid length parameter passed to the LEFT or SUBSTRING function” error

I'm running into the "Invalid length parameter passed to the LEFT or SUBSTRING function" error, but it goes away and the query works when I include the column I'm passing into those functions, any ...
0
votes
2answers
34 views

How can I only UPDATE if the user was created?

I got A cursor with some ifs like this one: IF @ROLE='RW' BEGIN SET @COMMAND =' USE '+QUOTENAME(@DATABASE)+' CREATE USER '+QUOTENAME(@...
0
votes
3answers
50 views

Column in INSERT query needs to increment if matching data on rows is different

I tried to simplify what I am trying to do. This is for work, we sell metal. When an order is placed material, coating, masking, etc. is chosen. Then someone allocates material for the order. They ...
0
votes
1answer
23 views

Mail Alert when threshold of 10000 pendingcmds are breached

I currently have the below running to monitor replication and send a mail when the threshold of 10000 pendingcmds are breached, however the alert mail is generated every 5 minutes regardless of the ...
1
vote
1answer
29 views

Total_worker_time over SQL 2008 linked server

I’ve come across a lengthy SP that is being recorded as generating a high amount of total_worker_time in sys.dm_exec_procedure_stats. (But I think it might be a red-herring) The SP contains cursors ...
1
vote
1answer
27 views

Best way to insert error information from catch block in the table for stored procedure?

I have stored procedure that process single row transaction. I would like to catch any errors and insert in Error table. Then use nightly process to forward the information from error table to ...
2
votes
3answers
130 views

SQL How to Convert Single Tenant Databases to a Multitenant Database

We have a legacy application. For some reason, someone decided to create a database for each customer. So we have 500+ databases with the same schema. I would like to convert into One multi-client ...
0
votes
2answers
38 views

Select repeating number x times and then increment

I need a select query that can generate z amount of rows starting from 1, repeating x times and then increment to the next number. For example 10 rows repeating 4 times would result in the following: ...
1
vote
2answers
63 views

How to show how many times the server was restarted on SQL Server?

Is there any way to show how many times the server was restarted this month? I'm using SQL Server 2008. Thanks
0
votes
2answers
40 views

Update data from one table to another in sql server

I have a log table where accidentally one date column got updated with current date for 9 Million records. Luckily I had a backup table, so now I want to populate data from backup table to current ...
0
votes
1answer
28 views

Difference between changed compatibility level database and new database

What is the difference between SQL Server databases A & B where: A. Database restored from lower level compatibility(100) to higher compatibility (130) B. New Database created in higher ...
1
vote
0answers
54 views

Return error with OUTPUT from CATCH block [migrated]

I have a stored procedure that executes a simple insert transaction with a try/catch block. If the transaction is successful, OUTPUT will return the inserted record ID. If an error happens, I would ...
1
vote
1answer
85 views

Best way to prevent deadlocks and server locking for single row Insert/Update transaction?

I have Update transaction that will run for single row at the time. However, my application is multi thread and there might be more than one user at the time trying to access same table. While doing ...
4
votes
3answers
136 views

Does MERGE prevent deadlocks and server blocking?

I have started looking at MERGE as an option that I would use in my application to process UPSERT transactions. Seems that a lot of SQL Server experts are recommending this approach. However, while ...
0
votes
0answers
22 views

full backup after failover cluster stuck for 11 hours

We have 2 nodes in a cluster environment one is a physical node and the other is virtual and both servers are windows 2008R2. the client performed a manual failover at night at about 7:30 pm(to the ...
1
vote
1answer
50 views

Generating maintenance database from maintenance tables currently in master and msdb

I want to create a maintenance database that i can clean up master and msdb, i am trying to collect all the table info from master and msdb that are not Microsoft tables, bearing in mind that some ...
0
votes
1answer
44 views

Instead of C:\SQLDBA\ServerName\Instance rather C:\SQLDBA\ServerName_Instance

I am trying to create a folder based on the servername\instance to backup up to, i want the folder to create as servername_instance. Could you please point out where i am going wrong as it creates as ...
1
vote
1answer
111 views

Split datetime records that fall between 10pm to 7am into new record [closed]

I am very new to SQL Server. I am trying to split time in time out records that fall between night shifts from a employee shifts table but I am having a difficult time doing so. Night Shift runs from ...
0
votes
1answer
25 views

data translating issues [closed]

I have these two table here in ssms: one is called client table, which have a column called city, and it is really city name, like new york, etc. Another table is called city table, it has city's ID ...
1
vote
1answer
63 views

Script SQL Server Agent jobs to file

I am busy making a backup of all Agent Jobs by scripting them all to file.`How would i rewrite the below to use BCP instead BEGIN SET @EchoCommand = 'ECHO ' + @EchoField + ' >> ...
0
votes
0answers
39 views

Transaction log shipping

I have transaction log shipping set up from my primary server to my secondary server. This morning, the LSRestore job failed due to insuffient drive space. The logs were still available on the ...
0
votes
1answer
88 views

Validate data between two large tables

I have this scenario. Data files are transferred from multiple stores (transactions) to the head office as they happen. For each store the table in question is pretty big in size. At the head office, ...
0
votes
1answer
32 views

Clone SQL Server databases [closed]

I have a 2 databases on 2 servers, Server A db1 and Server B db2. Db 1 is a clone of db 2 from 2 weeks ago, and was never updated since then. There is a short way to make db1 exactly like db2?
1
vote
1answer
25 views

Expanding Data File with Log Shipping and Mirroring: SQL Server 2008 R2

I am in a situation where I need to expand a data file by 750 Gb in order to get to 20% free space in the data files. This is a requirement by our third party application developer in order to ...
1
vote
3answers
28 views

What circumstances could a SQL DateTime column hold an invalid date?

I have been asked to write a series of tests within SQL. Many of them are to test if a certain DateTime columns held in the system is a valid date. Given that the all the fields in question are ...
2
votes
1answer
48 views

Vulnerability in Server from SQL Server 2008 R2

We scanned our systems and got a high vulnerability reported in a server. One of the thing that got flagged was MS12-060, which is related to MS Office 2003 Web Components that gets installed along ...
0
votes
0answers
48 views

Make the linked server ask for password

Till today i am using the linked server with the user of sql having same username and password in both the servers. For now on i can not keep the 2 servers password same for some reason and i still ...
1
vote
2answers
363 views

INSERT Statement error message references column I am not including in query

I am using MSSQL 2008. My INSERT statement is as follows: INSERT INTO [DB1].[dbo].[SpotArtSong](ID) SELECT SNG.S_ID FROM [DB1].[dbo].[SpotArtSong] SPOT INNER JOIN [DB2].[dbo].[nt-art] ART ON ART....
3
votes
1answer
43 views

Group together similar queries in sys.dm_exec_sql_text

I'm analyzing a 2008 Instance that supports a 3rd party app. The app will generate the SQL Code then send it to the Database as an ad-hoc query. I'm using this query (based on a Glenn Berry script): ...
6
votes
2answers
1k views

List All Dropped Databases

I need to confirm if a particular table ever existed in our SQL Server. Is there an existing script or method one can use to list all dropped databases in an SQL Server instance?
1
vote
1answer
147 views

Add values from two existing column into new columns for a total

We have two existing columns in our database named 'ClientIncome' and 'PartnerIncome'. We would like to add a new column named 'HouseholdIncome' We would like to add the values from 'ClientIncome' ...
0
votes
1answer
75 views

Microsoft SQL Server error 14545

I was trying to use copy Database wizard from one server to another to make a certain database identical and i got the error (The @flags parameter is not valid for a job step of type 'SSIS'. (...
-3
votes
1answer
61 views

calculate group by running total in sql server 2008 [closed]

I HAVE SOME SAME SAMPLE DATA IN MY TABLE ID | HOUSENO | AREAR | CURRENT | TOTAL_DEMAND | TOTAL_RECIVED ---------------------------------------------------------------- 1 | 1/10/1 | 0 | 165 ...
2
votes
1answer
87 views

Efficient join technique for two very large tables

I am working on a concept for database synchronization recently. The scenario is as follows: there is a master table "Items" with 1M+ rows in it CREATE TABLE [dbo].[Item]( [Id] [...
0
votes
2answers
24 views

SQL Query with Aggregate Count, where at least 1 of the counts has a value in a field

SELECT PERSON_ID,COUNT(APPL_ID) COUNTS FROM APPLICATIONS GROUP BY PERSON_ID ORDER BY COUNTS DESC The above query returns all persons who have applied for all time (essentially a count of the whole ...
2
votes
1answer
75 views

Okay to run sp_refreshview against all views on a regular basis?

Microsoft SQL Server has a system stored procedure called sp_refreshview which updates the metadata of the view that's passed in. Are there any downsides to running this procedure regularly on all of ...
0
votes
1answer
38 views

Statment running significantly slower than component parts and causes high CPU usage

I am running the following statement in SQL Server Studio 2008: Use Systems select subdirectory from [Systems].[dbo].[ScanningArchiveFileSystem] f where f.FileFlag = 1 and SubDirectory not in ( ...
0
votes
1answer
45 views

Evaluating most frequent values of columns in a single query

I have a table describing my application users with some details such as name, surname, birth date, nationality, email, etc... I would like to known for each property, and for each user category, the ...
0
votes
1answer
57 views

How to link data from two spreadsheets imported to sql

I imported 2 spreadsheets to SQL Server tables. One sheet has data containing persons name & surname, the project they are working on as well as there banking details. The other spreadsheet has ...
1
vote
1answer
71 views

SQL Server logical consistency-based I/O error

I have a job on my live environment DB and the job has failed again this morning reporting SQL Server Error 824 (Soft I/O error, where the OS could read the page but SQL has treated it as corrupt): ...
1
vote
1answer
23 views

Optimizing sorted table for join

In our asset tracking system, I have the following 2 tables: item item_location_date Where item_location_date has the following fields: ild_item (FK to Item) ild_location (FK to location) ...
1
vote
0answers
27 views

SQL Server 2008 to 2016 upgrade - Side-By-Side Upgrade, Project Plans and timelines [closed]

I'm planning on upgrading SQL Server in our organization from 2008 to 2016. We have several servers and about a dozen databases (20-25 SSIS packages and a hundred SSRS reports). SQL Server is used to ...
3
votes
1answer
75 views

GZip existing varbinary(max) column in Sql Server 2008+

I have an existing legacy table that is ~180GB in size due to a client application storing PDF files as varbinary. I'd like to be able to compress that column for all rows using GZIP to help save ...
1
vote
0answers
31 views

need help with multiple column aggregate using pivot in mssql

below is the temporary table for class assessments. this table contain list of class assessment which include the assessment code, date of assessment, total item and passing percentage. create table #...
7
votes
1answer
539 views

How to GRANT permission to execute stored procedure?

I have an AD group that is setup as a Windows Authenticated SQL Login on my SQL Server. On DatabaseA it has the db_datareader and public roles. So the users of this AD group only have read access to ...
0
votes
1answer
130 views

SQL Server 2008 Database encryption

In my company there is MS SQL SERVER 2008 standard edition installed. My problem is we want to encrypt whole database but in standard edition there is encryption like transparent-data-encryption(TDE) ...
4
votes
1answer
476 views

How to repair corruption for “Possible chain linkage problem.”

I have large table with 15 000 000 record and suddenly Select Top stopped working. I use MS SQL Management Studio. This is not working, the query return 0 records: SELECT TOP (10) [Id] ...
1
vote
0answers
88 views

How to reset SQL Server Configuration Manager Windows To Original Windows Configuration (as if it had been newly installed)

I have been looking at a lot of articles, and still cannot come up with an answer to the following. I am running Windows 10 workstation, and have installed SQL Server 2008 R2 Developer. This problem ...