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

Questions tagged [sql-server-2008]

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

-1
votes
0answers
28 views

MS SQL Server Migration 2008 -> 2016 [duplicate]

Gurus - I was recently asked to perform an analysis of what will it take the company to migrate/upgrade On-Prem MS SQL Sever 2008 to 2016. I googled around, but did not find much regarding this. Can ...
1
vote
1answer
33 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
52 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
51 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
19 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
votes
0answers
30 views

SQL Server 2008 R2 - Settings to run deletion statements faster [on hold]

I am working on a project to delete entries from a database. I have a script that goes through about 4000 tables and deletes entries that meet a certain condition. Basically, I am batching the tables ...
1
vote
0answers
44 views

Microsoft SQL cell character limit [closed]

I am running into an issue when I am querying one of our databases on a Microsoft 2008 server, it will limit the amount of characters in a single cell. Any cell that has more than 50 characters will ...
0
votes
1answer
29 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
59 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 ...
0
votes
1answer
34 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 contributer was adding this to sp_blitz, but that's been closed ...
0
votes
0answers
24 views

Daylightsavings [duplicate]

DECLARE @locTime as time DECLARE @timee as nvarchar(10); set @locTime = (select Dateadd(minute, 330, getdate())) SET @timee = (SELECT LEFT(STUFF(CONVERT(NCHAR(8), @locTime, 8), 3, 1,''),...
0
votes
1answer
62 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
150 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
8 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
149 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
54 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
49 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
37 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
34 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
32 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
12 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
21 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
votes
0answers
17 views

MS SQL: Reference to database is not supported in this version of SQL server

I am trying to connect two database server. (one local and one remote server) I created linked servers and tested it successfully. However, when I am trying to access the tables under this database. I ...
1
vote
2answers
87 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
25 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
33 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
228 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
465 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
40 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/...
2
votes
2answers
150 views

How to join global temp tables in SQL Server?

I have four global temp tables (##A,##B,##C,##D) on which I want to perform a left join in SQL Server 2008. By global temp tables I mean I created them using a code like this: SELECT * INTO ##A ...
0
votes
1answer
55 views

What is PROC FREQ equivalent in SQL?

I want to use the functionality that PROC FREQ provides in SAS. PROC FREQ helps in giving the statistics such as frequency, percent, cumulative frequency etc. of a variable or variables. The link ...
0
votes
1answer
68 views

How to remove temp tables from SQL Server?

I want to remove temp tables that I was using in my script in SQL Server 2008. I can't find a way to remove it without writing a few lines of code. I have not been able to find code that works ...
2
votes
1answer
35 views

How to execute a query based on the condition if a column exists?

I want to run the following query: CREATE TABLE dummy AS SELECT x, y, z FROM table1 WHERE y!=0 then I want to do the following: if z column has a non-null entry do: 1. copy the content of z into A ...
5
votes
2answers
395 views

How to import CSV file in SQL server 2008?

I am trying to import a CSV file in SQL Server 2008. BULK INSERT is a way to go but it is applicable for CSV from SQL Server 2014 onwards. What would be an alternative way to achieve this goal? Any ...
1
vote
1answer
96 views

How to set the first row of CSV data as column name in SQL Server?

I am using BULK INSERT to read a csv file in SQL Server. Is there a way to keep the first row as column name while I am reading the file? If not, after reading the data from the csv (from second row),...
0
votes
1answer
57 views

Help me with sql backups please

I'am facing some difficulties regarding my Sql Backup method, i am not sure if my method is correct, i am using a backup method described below; Created a Full backup named Xbackup in Maintenance ...
0
votes
1answer
27 views

What is the infile SAS equivalent in SQL Server?

I am trying to read a csv file in my SQL Server Script. In SAS, I can read it using the infile option. (http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000146932.htm) ...
1
vote
2answers
149 views

How to define macros in SQL server?

I want to define a macro in my SQL script and later based on my conditional query I want to create a new variable name which will be 'X'+macro name. For example, say I define a macro 'month' which ...
2
votes
1answer
90 views

SQL Server - Remove all logins that they are asossiated with orphan users

I have an SQL Server 2008R2 that had lots of databases. The procedure was that a logins were created and users were mapped to databases. Most of these databases have been removed from the server ...
0
votes
1answer
41 views

How to get current month and year of the database as a macro in SQL server?

I want to get the current month and year of the system into a macro variable and keep using that macro variable to create related new variables. The purpose is that if I run my script every month, I ...
0
votes
2answers
57 views

Query to get all the columns in a view

I've got this little ditty to concatenate all the columns in a table, for writing scripts quickly: create function [dbo].[get_columns] (@table_name varchar(255)) returns varchar(max) as ...
0
votes
1answer
72 views

Validation of data with checksum vs Binary_checksum

Based on this post, I was able to solve the performance issue by adding indexes and thought I completed my project until I ran into an issue with the checksum... I then did research (should have done ...
1
vote
1answer
21 views

Migration from SQL Server 2008 R2 to SQL Server 2012 SP2

I have many backups on my SQL Server 2008 R2 system, and I must restore them on new SQL Server 2012 SP2. My question is, after the restore on new SQL Server 2012, what can I do to verify that ...
0
votes
1answer
58 views

How can I get SQL to do the sensible thing without resorting to a query hint?

I have two tables, Items and Grouping. Items has about 7 million rows whereas Grouping only has 300,000. Of the two conditions on my query, the 'human obvious' thing is to evaluate G.StatusID IN (1,2)...
0
votes
1answer
18 views

ACE.OLEDB.12 installed but everything has a 0 on sp_msset_oledb_prop

So I installed ACE.OLEDB.12 to import excel files into sql server. After this, I can acces this procedure to see if everything is ok, but it's not. I have Zeroes on everything. This is a simple ...
3
votes
0answers
57 views

Moving to version 2016 from 2008 and Breaking Change Alert from Upgrade Advisor

DBMS: SQL Server Upgrading from version 2008 to 2016. I have this part of the code that is being flagged by the Upgrade adviser as Breaking Change. Error: uses a constant expression which are ...
3
votes
2answers
180 views

New SQL Server with slow Index Spool (Eager Spool) and old server used index

So yesterday I posted this question regarding that we have upgraded from SQL Server 2008 to SQL Server 2017 and that we excperience some performance problems. I got the answer to try updating ...
0
votes
2answers
61 views

What's the best way to get the top N, then everything else as n + 1

For example, if I've got this query: select top 10 medication_name, count(1) from DimMedical group by medication_name order by count(1) desc I can easily get a count of the ten most ...