Questions tagged [sql-server-2008]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

Inserting Millions Records Into A Table With Identity Column In Sql Server

I was changing the primary key column to different column on a table which contains about 300 million records in itself. I used the table design screen to change it but it got time-out. And, i decided ...
1
vote
1answer
172 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/...
1
vote
1answer
24 views

Memory issue in Transactional Replication

I want to replicate a data of 500 GB through transactional replication once in a day, so my query is this, will it create a new file in the snapshot folder on daily basis of 200-300 GB or will update ...
-1
votes
1answer
47 views

How can I achieve the below case in marketing cloud without using loop? [on hold]

I have a table like this and in the table you can see 123 losing to 456, 456 losing to 789 and 789 losing to 101112 and in the same fashion for ID's 5 and 6. In this case I want to replace winner ...
12
votes
4answers
71k 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 ...
0
votes
1answer
24 views

Passing Variable in json_value in sql server 2016 [duplicate]

declare @id int set @id = 1754 select (JSON_VALUE(cast(ad.data_map as varchar(max)),'$.dataMap."1754".value')) CorrespondanceNumber, (JSON_VALUE(cast(ad.data_map as varchar(max)),'$.dataMap.***"'+...
9
votes
2answers
9k views

How to trace SQL queries which are crashing SQL Server

We have a SQL Server 2008 database server (it happens to be running under MS Failover Clustering, but I don't think that is relevant here). Our application runs Hibernate for DB access, and since we ...
0
votes
0answers
43 views

A Procedure Causes Some Blockings In SQL Server [on hold]

There is a stored procedure in my sql server database and it causes so much blockings for itself. Here is the code. How to solve this issue? USE [FATURA] GO /****** Object: StoredProcedure [dbo]....
11
votes
1answer
347 views

SQLServer Upgrade Advisor 2014 hanging

I try to run SQL Server Upgrade Advisor 2014 against a SQL Server 2008 server. Everything looks fine when connecting to the 2008 server and I can select which database I would like to analyze. But ...
0
votes
0answers
21 views

SQL Instance not upgrading after install SQL Express 2014 [on hold]

I'm trying to upgrade SQL Server 2008 R2 version 10.52.4000.0 to SQL Server Express 2014. All the packages seem to install correctly, however the Database Instance never upgrades. I don't see any sign ...
1
vote
3answers
102 views

Query to see Index Fragmentation on all databases without using SP or temp tables

I am trying to compile a index fragmentation report on all databases, in a multi-server environment. The query will be executed via an openquery command, so I would like to make it as simple as ...
7
votes
4answers
9k views

In SQL Server 2008, how can I get all the columns that are marked as nullable in their schemas even though no records contain NULL for those columns?

In my legacy database, a lot of the time the schema needlessly allows null entries for particular columns. To help find out which columns in particular, I need to do some querying of SQL Server 2008 ...
18
votes
7answers
2k views

Group daily schedule into [Start date; End date] intervals with the list of week days

I need to convert data between two systems. First system stores schedules as a plain list of dates. Each date that is included in the schedule is one row. There can be various gaps in the sequence ...
18
votes
3answers
6k views

Why might a table's data space take up 4x the size of the raw data?

I have a table with 490 M rows and 55 GB of table space, so about 167 bytes per row. The table has three columns: a VARCHAR(100), a DATETIME2(0), and a SMALLINT. The average length of the text in ...
0
votes
2answers
90 views

How to grant or allow a particular SQL Server Login/User to always view a Column Level Encrypted data?

I used Column Level Encryption to encrypt one of the columns in my SQL Server database. Now everytime I want to SELECT to see that encrypted data, I have to open the symmetric key to decrypt the ...
13
votes
3answers
10k views

Is it possible to get execution call stack in a trigger?

I have 10 stored procedures and each of them does INSERTs into one tableX. Is it possible in a trigger body of tableX to get what object causes modification of tableX (stored proc1 or sp2 or....) ? ...
0
votes
2answers
110 views

Accessing Registered Servers over Excel

With DBs in different countries, different servers but same structure, I have created registered server to access them when running certain queries for reports on SSMS. Thus far this is ok. However, I ...
4
votes
1answer
625 views

Converting Monthly Rolling SUM (YTD) back to Monthly numbers

I'm having a problem converting rolling SUM by month (monthly year to date) back to only that month's numbers. For example, see table below. Periods are (YYMM) and a monthly period per year starts ...
28
votes
2answers
11k views

If positive, sum all items. If negative, return each one

I am needing to find a way to SUM() all of the positive values for num and return the SUM() of all positive numbers and an individual row for each negative number. Below is a sample DDL: Create ...
2
votes
1answer
2k views

SQL Server 2012 Installation Error on Windows 2008 Server

I am facing an error while trying to install SQL Server 2012 EXPRESS ADVANCED EDITION(32bit) on Windows Server 2008 Enterprise(64bit). After passing Rule Check, at install updates section, error ...
13
votes
5answers
24k views

Pros/Cons Using multiple databases vs using single database

I was working on a new project which has the requirement to use 7 databases. Arguing performance, stability, optimization is easier implemented. While I don't agree, I'm having trouble collecting ...
1
vote
1answer
132 views

Why is FORCE JOIN option slowing down query and forcing execution plan to sort prior to joining tables?

I'm linking Orders data with the Results data for those orders. Here's the SQL query for joining and selecting the ; with orders as ( select o.*, otr.*, oo.* from Order o inner join ...
0
votes
1answer
96 views

Find time between status changes for each unit on each incident

I have a table called History that holds unit status changes when they are assigned to incidents. Each unit can change status from DP to AK to ER to AR. Statuses can be skipped. The table is called ...
0
votes
0answers
19 views

Insert Into Table From SQL Server To MySQL

I am on server1 which has a linked server to server2 and server3. This must be done on server1, but I can not get the syntax accurate. What I want to do is query server2 using OPENQUERY, and ...
1
vote
1answer
122 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 ...
15
votes
5answers
5k views

How to add 1 milliseconds to a datetime string?

Based on a select, I can return x rows like this: 1 2019-07-23 10:14:04.000 1 2019-07-23 10:14:11.000 2 2019-07-23 10:45:32.000 1 2019-07-23 10:45:33.000 We have all milliseconds with 0. Is ...
13
votes
7answers
150k views

How can I take backup of particular tables in SQL Server 2008 using T-SQL Script

I want to take a backup of particular tables available in my database in a .bak file, and all these should be done using a T-SQL script.
0
votes
2answers
43 views

How To Grant A User Just To Create A Table In Existing Database But Not To See Other Existing Tables In It

We have dealed with an outsource company to install an application for use of our accounting department. Now, they want to access our existing database to install their application but i don't want ...
0
votes
2answers
280 views

Using Cursor to loop through a Table variable in SQL Server

I have a parameter in the Stored Prod which gets some data in the format 1/1/2018-2/1/2018,2/1/2018-3/1/2018,3/1/2018-4/1/2018,4/1/2018-5/1/2018,5/1/2018-6/1/2018,6/1/2018-7/1/2018,7/1/2018-8/1/2018,...
-3
votes
1answer
53 views

The login is from an untrusted domain and cannot be used with Windows authentication

I am facing this issue after trying to run a Windows application on sharing client side in a workgroup environment, while this application working on server machine fine.
1
vote
1answer
231 views

SQL log directory has too much dump file

My SQL Server 2014 is automatically creating SQL dump file. It is generating automatically to take all the spaces and hangs over the database. Error: 8310, Severity: 16, State: 1. Cannot create (...
0
votes
1answer
491 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, ...
1
vote
3answers
2k views

Can't create indexes on really large table!

I have a table with over 300 Million rows in it. When I try to create an index on the table I get the error message below. Msg 1105, Level 17, State 2, Line 3 Could not allocate space for object ...
2
votes
1answer
105 views

Replace/upgrade mirrored server hardware

We are deploying new VMs for a mirrored database that is in high safety mode with automatic failover and also going from SQL Server 2008 to SQL Server 2008R2. Most of the documentation I've come ...
0
votes
1answer
64 views

Mssql query problem. Column '' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

There is a problem I have experienced in mssql. ( but I don't have this problem in mysql. ) They know two different engines. but I could not find a solution. Do you think I can fix this error? My ...
5
votes
3answers
2k views

After upgrade of SQL Server 2000 database to SQL Server 2008 the view is not sorted on the group by column

I have two tables Location Master ([LocatioNo],[LocationName],[Description]) Location Data ([LocationNo],[LocationCode],[DDate],[BillNo],[Model],[Quantity],[SNo]) (source: staticflickr.com) ](http://...
3
votes
1answer
89 views

SQL Server 2008 R2 Edition Upgrade Process

I have several SQL Server 2008 R2 Standard Edition instances that we need to upgrade to SQL Server 2008 R2 Enterprise Edition. If I have valid SQL Server 2017 Enterprise Edition (with SA) PIDs, do I ...
1
vote
2answers
106 views

Upgrade BI server to 2014 and stay on 2008r2 with the database engine server

We would be happy to upgrade our SQL Server environments to 2014, but we have a tight budget for next year. Our BI server (SQL Server 2008 Standard Edition, that is used only for BI purposes) is ...
2
votes
1answer
131 views

Max Degree of Parallelism for SQL Server 2008

Microsoft have recommendations around setting MAXDOP on various versions of SQL Server, but this (old) article raises some issues and recommends setting MAXDOP = 1 generally for SQL Server 2005 and ...
0
votes
2answers
854 views

Error cs1567 while installing ms-sql on windows 8.1

I tried to install sql server 2008 and 2012 on my windows 8.1 laptop, but at both times I faced with the same error: TITLE: SQL Server Setup failure. SQL Server Setup has encountered the ...
19
votes
4answers
36k views

How to clone a user in SQL Server 2008 R2?

Is there a way to clone users' security and permissions in Microsoft SQL Server, preferably using the SQL Server Management Studio GUI?
6
votes
3answers
3k views

Is it possible to alias a column based on the result of a select+where?

I have a table like this: TB1: COD | A001 | A002 | A003 1 cars baby nasa and then a second table: TB2: COD | NO_COL_TB1 | DESCRIPTION | 1 | A001 | Something 2 | A002 | ...
11
votes
2answers
64k views

Convert a datetime column to number of seconds

In my SQL Server database, I have a datetime column. What is a good way to create a new column that represents the long value for the datetime column? The long would represent a number of seconds. I ...
68
votes
7answers
197k 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?
2
votes
1answer
59 views

SQL Server takes an hour to fail over to secondary node

I am at a new job, we have a 2008 R2 (SP1) WSFC which hosts SQL Server 2008 FCI. Each node has it's own storage, nodes are 32 core with 32 GB memory (don't ask me why it is configured this way). ...
0
votes
1answer
182 views

Syncing Database to Application (polling)

I have created a windows application that uses a MS SQL 2008 database server. There are two types of the application: 1) Client Application 2) Host Application The client application is able to ...
0
votes
1answer
26 views

Get last Reoganized OR Rebuild index date

I am currently working on migrating sqlserver 2008r2 to SQL server 2016.The DBA before me used "IndexOptimize" from https://ola.hallengren.com/downloads.html to create the iIndex solution. I can see ...
8
votes
2answers
5k views

What would cause an orphaned ##MS_PolicyEventProcessingLogin##?

This morning I noticed my SQL Log was filling with the following message: The activated proc '[dbo].[sp_syspolicy_events_reader]' running on queue 'msdb.dbo.syspolicy_event_queue' output the ...
0
votes
1answer
182 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 ...
37
votes
7answers
220k views

Writing select result to a csv file

We need to write the SELECT query results to a csv file. How can it be done using T-SQL in SQL Server 2008 r2? I know that it can be done in SSIS, but for some reasons, we don't have this option. I ...