Stack Exchange Network

Stack Exchange network consists of 175 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

Questions tagged [sql-server-2008]

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

0
votes
1answer
33 views

MSSQL 2008 Database Compatibility Level to MSSQL 2016

I have this database with hundreds of stored procedure, views, triggers, function, ... The database Compatibility Level is 2008 (100) and we would like to move it to 2016 (130). The Sql Server version ...
0
votes
1answer
26 views

Questions on database table and index partitioning in SQL Server

I have developed Transact-SQL script to partition the table. To apply the partition, I am creating one non-clustered index for my partition key column and associating it to partition scheme. I have ...
3
votes
1answer
80 views

Why would writing the CTE to an actual table provide a performance improvement?

I'm a huge fan of CTE's. They are the best. You know it, I know it, we all know it. Today, I got burned with a query that is about 1000x faster if the CTE is written to a real table. The query ...
3
votes
1answer
36 views

Select/Join multiple row values from Column A if dates in Column B are within 'x' seconds of each other

I have the following Database structure and need a query to work in SQL Server 2008 and also SQL Server 2014. Database: ASSETS Table: COMPUTERS PK (GUID) (nvarchar) (nvarchar) | ...
1
vote
1answer
35 views

How do I shrink the MASTER log file in SQL Server 2008?

This is for a non-system database: USE AdventureWorks GO ALTER DATABASE AdventureWorks SET RECOVERY SIMPLE GO DBCC SHRINKFILE (AdventureWorks_Log) GO ALTER DATABASE AdventureWorks SET RECOVERY FULL ...
2
votes
2answers
57 views

What is the best way to calculate year over year inflation?

My ultimate goal is to calculate money from previous years as 2019 dollars. I've got these numbers from the BLS, and create the CPI_U in sql like so: create table CPI_U (year int, dec decimal(4,...
2
votes
1answer
61 views

Splitting a year into pieces

I want to split a given year into given number of date range pieces using SQL. Following points need to be considered while splitting it: Given year will always start from 01-01 and end at 12-31 and ...
0
votes
1answer
96 views

SQL Server major performance difference between two versions [closed]

I have SQL Server installations. Both run under HyperVisor on the same processor. They both have the same number of core/RAM/disk space assigned. One is the old server and the other is the new one. ...
0
votes
3answers
61 views

Deprecated raiserror detection

I want to upgrade SQL server from 2008 to 2014 versiyon. I checked all of the deprecated features including raiserror syntax. But I have many stored procedures to check. Some of them use new syntax, ...
1
vote
1answer
25 views

SQL Server 2008 onward - Globalization with Date Time

My application is standalone windows application. Database is SQL Server 2008 onward. The application will be deployed on systems around the globe. User should view the date/time values in their own ...
1
vote
1answer
43 views

Correcting and Detecting overlapped dates with CTE

I have a CTE that marks (as bits) overlapped records based on certain criteria. After filtering, I need to update these records to "correct" them and make them sequential, but I'm getting a 4104 on ...
1
vote
1answer
45 views

Where to install or use SQL Server?

New to the database side of IT and I have a few questions... I'm trying to figure out what servers and databases I can access through SSMS. What is the best practice for installing/using SQL Server ...
-9
votes
1answer
70 views

Can someone assist with update statement beginning to end? I am new to development so please do not expect me to understand everything [closed]

I have been teaching myself as I go and having trouble updating a varbinary column. The issue is the column has a different data type. I want to convert varbinary to bit. My code looks like: ...
2
votes
3answers
54 views

Select data from another database instance on the same server in sql server

I have a query shown below select count(*) as Count, datepart(yyyy, [LogDate]) as [Year] from ViewAssociate..Auth_Log where ActionCode = 12 group by datepart(yyyy, [LogDate]) order by [Year] Now ...
0
votes
1answer
21 views

MS Access Foreign key not working in SQL Server

In MS Access I have a 'multi column - One to Many' foreign key between two table. When I try to create the same relationship in SQL Server I get a message " The columns in table 'Laser_Status_info' do ...
0
votes
2answers
86 views

What is the best way to remove large amount of data from large tables?

I have two large SQL 2008 tables: table_header with 7 columns and ~ 2 million records table_detail with 22 columns and ~ 78 million records The common field between the two is called item_name ...
1
vote
1answer
30 views

How to Convert List of values datatype in oracle to equivalent or valid datatype in sql server?

I want to recreate the table below in SQL server I have tried using SSIS but it does not know how to handle the lOV Data type how can I recreate this table in SQL server and migrate the data to it. ...
0
votes
2answers
70 views

Create SQL login to multiple instances at once

I have a AD group that needs to be added to multiple SQL instances, I am wondering is there a quicker way of adding this group at once rather than having to login to each server and creating a login ...
-1
votes
0answers
20 views

Splitting comma separated values into rows [duplicate]

SELECT A.substance, Split.A.value('.', 'VARCHAR(2000)') AS String FROM (SELECT substance, ID, CAST ('<M>' + REPLACE(substance, ',', '</M><M>') + '</M>' AS XML) ...
1
vote
2answers
49 views

Bulk insert not retaining special chars of UTF-8 Encoded txt file Sql Server 2008

I have a stored procedure that bulk imports a text file and inserts it into my database. CREATE TABLE DBO.TEMP_STORE ( ID nvarchar(max), [MONTH] nvarchar(max), [...
-2
votes
1answer
22 views

Get Average of a column excluding the current month [closed]

I would like the average to be average excluding the current month counts. I.e for November the average would calculated based on Jan-September values. How do I do this using SQL Server 2008?
1
vote
2answers
73 views

The merge process could not connect to the Publisher ' '. Check to ensure that the server is running. (

I have 2 servers with 2 kinds of replications between them. One is Transactional and the other is merge. The Transactional replication is working fine but in the merge replication, I'm getting error ...
0
votes
2answers
36 views

Get data from both tables what join should I use

I have T1 as table 1 ---------------- field1 | field2 --------------- val1 | val2 I have T2 as table 2 ---------------- field1 | field2 --------------- val11 | val22 I want to write a query ...
1
vote
1answer
40 views

Using LIKE for a Range of Numbers

In my WHERE clause, I'm trying to use LIKE for a range of numbers. For example: WHERE rr.sequence LIKE '05600%' OR rr.sequence LIKE '05601%' OR rr.sequence LIKE '05602%' OR rr.sequence ...
1
vote
1answer
36 views

Instead of Delete trigger

I want to pass one validation DML statement on the trigger. Condition is below DML statement select distinct t1.cid from table1 t1, table t2 where t1.cid=t2.cid and t1.status<>'...
1
vote
2answers
55 views

Select rows that have multiple required filters

How can I select artists who have punk and rock in their musical genres? I need artists with both genres. A example: SELECT * FROM artist_genre WHERE genre_id IN (1,2) In this way I recover all ...
1
vote
1answer
56 views

How often should you update your stats?

How often should you update your stats? What is "too seldom"? How often is "too often"? The answer is "it depends" on your database, users, data, etc. So I've tried to log what our stats look like ...
1
vote
1answer
23 views

Error on CDC enabled Table

I am trying to create an SP on a CDC enabled database. SP contain an update statement for CDC enabled table using UPDATETEXT command but CREATE PROCEDURE statement has generated an ERROR Message. "...
1
vote
1answer
37 views

Migrating SQL server 2008 to 2016 [duplicate]

Is there any check list for how to do migration from SQL Server 2008 to SQL server 2016 ? I am building a new server for the 2016 want to move all the DBs from the old server 2008 to the 2016 any ...
3
votes
1answer
63 views

DBCC unique cluster index corruption

I am very new to the world of DB maintenance and recently ran to an issue that will appreciate your advice on. I have a Database that the earliest solid backup file I can see without any corruption ...
1
vote
2answers
61 views

sp_blitzfirst results to table on a linked server

I have been all over looking for the solution to logging sp_blitzfirst results to table on a linked server. I see github posts where a contributor was adding this to sp_blitz, but that's been closed ...
0
votes
1answer
152 views

Why does msdb.dbo.backupset have entries for each database every 15 minutes?

I have 134 separate databases on a SQL Server. Every 15 minutes an entry appears in the msdb.dbo.backupset table for each database on the server. Why does this happen every 15 minutes? What is ...
1
vote
2answers
155 views

Shrinking a SQL Server 2008 Standard database to move it into SQL Server 2014 Express

I need to shrink a popular CRM database with SSMS to move it onto a new server. I am going from SQL Server 2008 Standard to SQL Server 2014 Express. Database is in Simple Recovery Model. It needs to ...
1
vote
1answer
9 views

Switch publisher - subscriber side

I have 2 server using merge replication. One acts as a Publisher and one acts as a Subscriber. One day I want to switch the side, publisher become subscriber and subscriber become publisher. In my ...
1
vote
2answers
168 views

ghost cleanup, delete and reindex

I know when you delete data, that data is only "marked" as "deleted' for faster rollback. The only way to really delete this data is to run something that reads the datapage, such as a table scan or ...
1
vote
1answer
56 views

Find all occurrence of value from column b in column a

So basically I have 2 tables which I merge by SELECT t2.columnA , t1.columnB, t1.description FROM Table1 as t1 LEFT JOIN Table2 as t2 on t1.GIDNumber=t2.TwrNumber I need to display all occurrence ...
0
votes
1answer
50 views

CPU and Hard Drive Spike for 20-30 Minutes

I'm collecting data on the performance of our Microsoft SQL 2008 server in preparation for moving it to Azure. It's a very low load server (currently max concurrent transactions max out at 3), ...
0
votes
1answer
48 views

Remove punctuation marks, special chars and space and compare cols

I have a table with new and old long description columns and I want to compare them by removing space, punctuation marks, and special characters for differences. Create table DESCR_COMP ( HCPCS Char(...
2
votes
1answer
43 views

SQL Server 2008 Version of rows between… preceding and current row

Being a beginner, I'm having a hard time coding this particular scenario in SQL Server 2008 As you can see, The SUM column for July 2017 for example is equal to the following: August to Dec 2016 + ...
0
votes
1answer
34 views

Most efficient way to execute DELETE and INSERT operations in the same Table

I have the following structure: Table1 Table2 C11, C12 C21 1 A A 1 B B 1 E W 2 F 2 B 3 ... I need to ...
1
vote
0answers
18 views

Joining 02 details tables, remove duplicated values from both sides in SQL Server 2008

In my case, both tables are details, sometimes it has 01 item in Tables A with mutiple items on Table B and vice versa. SELECT DISTINCT x._PROCESS_INST_NO, x._GOODS_CD, ...
1
vote
0answers
15 views

Filegroup per Table partition - remove filegroup and re-add filegroup

I've seaching all over the web for a solution, if it is even possible... I'm not a savvy in Partitioned tables in different filegroups... Our software is supported by SQL 2008 R2 SP2 to SQL 2017 for ...
0
votes
1answer
23 views

MS SQL: How to get Employee Status from two seperate tables

I am new to MS SQL so please bear with me. I want to get the Company Code and Company Short Name of an employee DEPENDS on it's each employee status and stored it into one table. If Emp_Status = FT, ...
1
vote
2answers
198 views

MAX DATE With NULL VALUE

Trying to get the max date from my table, i can't retrieve the value when the date is null. Sample : the following table : +----+--------+------+------------------------+ | id | parent | Date ...
0
votes
1answer
29 views

Frequent Remote connectivity issue for SQL Server 2008 SP3

I follow all your blogs all helped me in my real-time issues. From last 2 days I'm facing connectivity issues to SQL server even though all the parameters are correct and cross verified with your ...
1
vote
1answer
36 views

Pages Input per Second Spiking Daily

I'm still learning a lot about SQL Server and pretty green, but doing the best I can as an accidental DBA. We have recently purchased a SQL monitoring software package, and after adjusting the ...
2
votes
2answers
246 views

How do I use 'N' in my prepared SELECT statement

I'm connecting to an SQL Server 2008 database using pdo and the ODBC Driver 13 for SQL Server. I'm trying to run the following query which searches the database for Chinese characters: SELECT TOP (...
3
votes
3answers
106 views

Backing up a SQL 2008 DB, then restoring, gives a SQL 2005 (compatibility level 90) DB

We have four different databases on a SQL Server 2008 (not SP2 - don't ask me why) database server that have an odd problem. When listed from sys.databases, these databases report that their ...
2
votes
2answers
743 views

How to get the date part from a date with timestamp column in SQL Server?

I want to get the date in DDMMYYY format from a field that stores date in YYYY-MM-DD Timestamp format. (For example, '2018-11-09' should display '09Nov2018'). I know that one way is to use the ...
1
vote
1answer
64 views

MS SQL 2008 Databse in Suspect mode and CHECKDB returns error: Object ID 3 has chain linkage mismatch

We did a disk expansion for VM DB server. However, after this operation the DB became suspect mode and cannot be open. Then we tried somethings like that; https://www.sqlrecoverysoftware.net/blog/...