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
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 ...
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 ...
19
votes
7answers
101k views

"Could not find stored procedure' even though the stored procedure have been created in MS SQL Server Management Studio

I have created a table testtable inside the database testbase that have the following structure: product_no (int, not null) product_name (varchar(30), not null) price (money, null) expire_date (date, ...
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) | ...
2
votes
3answers
5k views

How to enable windows authentication on server that is not part of domain

We have an SQL server instance running on a standalone server (not part of the organizations domain network). Is there any way that we can use windows authentication to logon to sql server without ...
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 ...
0
votes
1answer
146 views

Determining CPU Usage of last week

We got a production issue last week (high CPU spike) on 25-Feb due to which server reboot was performed but ticket landed our DBA queue just today for analysis on CPU spike. Could you pls help me in ...
3
votes
2answers
9k views

Find fulltext indexes in SQL Server 2008

How do I find a list of tables that have a FULLTEXT INDEX applied to them on a given database? For example, you can enable and disable a FULLTEXT INDEX like this: ALTER FULLTEXT INDEX ON [dbo].[...
0
votes
1answer
38 views

Retaining access to table that will be dropped and recreated

I have a small GIS table that is is dropped and recreated from a third-party tool called MAPINFO. Each time I drop and recreate that table I grant access to roles created. Is it possible to retain ...
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. ...
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 ...
3
votes
1answer
153 views

Error when trying to start Microsoft SQL Server 2008 instance from SQL Server Configuration Manager

I get this error when I try to start Microsoft SQL Server 2008 instance from SQL Server configuration manager. SQL Server configuration manager : The request failed or the service did not respond ...
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, ...
6
votes
3answers
9k views

SQL Server 2008 Table Maintenance - Rebuild, Reorganize, Update Stats, Check Integrity etc

I'm migrating a ~15GB database from SQL Server 2005 to a new server running SQL Server 2008, and along with that I need to create all the new Maintenance Plans. I can take care of all the backup ...
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 ...
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 ...
0
votes
1answer
67 views

how do I determine why I cannot drop a schema

A schema was created with the name of a windows user [DOMAIN\Foo]. I receive this error message when attempting to drop the schema. DROP SCHEMA [DOMAIN\foo] Msg 15151, Level 16, State 1, Line 8 ...
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 ...
2
votes
1answer
4k views

SQL Server Management Studio Change User Server Roles to sysadmin?

On my local machine I have SSMS (SQL Server 2008 R2). For user xxxx Server Roles are only public. When I try to change it to sysadmin it throws the error: User does not have permission to perform ...
-3
votes
1answer
115 views

SQL Server message 3154 Server 2005 to 2008

So a week ago I walked into a new job where they are migrating SQL Server from version 2005 to 2008 and later to 2012. We have a great migration plan, been here done this before, like 8 years ago so ...
0
votes
1answer
194 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, ...
3
votes
1answer
181 views

SQL Server Agent Services not Coming Up

After the Windows Server 2008R2 was restarted after some planned downtime, the SQL Server Agent Service is not getting started. There are multiple SQL Server named instances and Agent Services of non ...
-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: ...
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 ...
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
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 ...
0
votes
1answer
216 views

SQL update next row in select

I have ran into a problem with SQL. I have a list with car and mileage data. What I need to do is for the empty fields to calculate data. Each row has a field for KM (mileage in KM metric unit), ...
0
votes
1answer
213 views

SQL query output to Sybase temp table

I need to query a MSSQL 2008 db for 4 columns of data where one column (an ID) is used to join a number of tables from a Sybase ASE 15 database then output all 4 columns from the SQL query with a ...
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), [...
0
votes
1answer
214 views

How to split a multivalued column, do a lookup and update another column?

This is a part of my previous question. How can I achieve the following for all the records in my table using a single query? SET @TeamMembers = TeamMembers from tblProjects where ID = '125' ...
59
votes
7answers
175k views

How to query last restore date in SQL Server?

Is there a T-SQL query that shows the last restore datetime for a certain database?
24
votes
6answers
84k views

Query to report disk space allocation and used space

We are using 6 databases in total for an application, and we can only share 4TB of space among all 6 auto-grow databases (via SAN storage). I'd like to write a query (report) for a single database ...
-2
votes
1answer
255 views

SQL Server 2008 R2 couldn't be started [closed]

The SQL Server Service Couldn't be started and logs the below error in the event viewer Log Name: Application Source: MSSQLSERVER Date: 4/9/2017 12:36:06 PM Event ID: 9003 ...
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 ...
-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
1answer
243 views

How to manually invalidate a pull merge replication snapshot from the publisher

XY Problem background info: I have a pull replication publisher in which I want to add or alter a index and have those changes be applied to the subscriber. The solution to that problem I would like ...
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
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 ...
0
votes
2answers
275 views

Side By Side Upgrade and Migration from 2008 to 2016

Side By Side Upgrade and Migration from 2008 to 2016 Old Server Name Test1 New Server Name Test1 Default Instance Test 1 My question is when the new server be named as the old one 'Test1" and it ...
11
votes
3answers
66k views

How do I run a batch file from a scheduled Job via SQL Server Agent

I'm attempting to run a (Windows) batch file from within a SQL Server agent job under SQL Server 2008 R2. In the Job Steps, I've created a new step, set its type to "Operating system (CmdExec)". I ...
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<>'...