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.

1
vote
1answer
36 views

Transact-SQL script equivalent to the option: Apply Tracked Changes

Could anybody tell me what is the transact equivalent script of using the: Apply Tracked Changes menu?
5
votes
4answers
2k views

Why would SQL Server automatically remove manually created indexes?

What causes Microsoft SQL Server to remove manually created indexes automatically? Every index I create it removes within a few hours. Here is the code I use to create the indexes. Affected views run ...
-1
votes
1answer
3k views

how to sum decimal values in sql server [closed]

I am working on an sql queries where i have a temp table named DECLARE @tcal table(TagIndex smallint,TagName nvarchar(20),Total decimal(18,2)) in which decimal numbers are used to stored. The ...
2
votes
2answers
1k views

How to get random datetime of current day in SQL Server

I am working on a SQL query where I need to get datetime of any specific date. For this I used the following query: DECLARE @RandomDate datetime DECLARE @fromDate datetime = '2018-04-07' SELECT ...
1
vote
1answer
157 views

How to restore .bak only if it's good

I'm using Tsql script to restore several databases. RESTORE DATABASE XXX_M FROM DISK = 'C:\XXX.bak' WITH FILE = 1, replace GO Sometimes the .bak file comes corrupted (not data corrupted ). I ...
3
votes
5answers
1k views

Creating a Persisted Computed Column with a function

I am working with the programmers on a database solution. They want to add a computed column to mimic the old keys for the older queries, procedures, and systems and index it. The new keys will be ...
1
vote
2answers
480 views

Merging continous date range using T-SQL

I have a table containing a part time working pattern consisting of start and end dates together with hours values. Where there is an gap between an end date and a subsequent start date, this ...
3
votes
1answer
403 views

Best practices on dealing with devs that want to use XP_CMDSHELL to BCP OUT

This is not a technical question. I would like to know the best practice to use in a place where devs want to have SA for everything. The most recent event is: Devs want to use BCP OUT to export ...
0
votes
1answer
501 views

Combine two table with different column but same value

I have two tables with similar value: TABLE A a_empno a_checktime a_updatetime a_status a_location ------- ----------------------- ----------------------- ------- ----...
1
vote
0answers
719 views

INSERT IGNORE/UPDATE IGNORE equivalency in SQL Server

I've got the following table structure. CREATE TABLE dbo.UserOrgUnits ( UserOrgUnitId int PRIMARY KEY NOT NULL IDENTITY, UserId int NOT NULL, OrgUnitId int NOT NULL, DateUpdated int ...
3
votes
3answers
42 views

Can I retrieve all database objects owned by a particular database?

Is there a way to search all database objects by a particular database name or its id. Is that possible? I would like to do this so that I can find out how many stored procedures, functions, views, ...
1
vote
2answers
44 views

Does an index continue to be used after it is dropped (Database Polling investigation)

The folly of developers who use database polling is shown below. I have identified a query below which did not have an index in place on a particular column In addition to polling the database every ...
0
votes
2answers
152 views

Reorganize and Rebuild Indexes with active connections

I want to rebuild or reorganize indexes in a table. What happens if there are active connections to that table at the moment?
0
votes
1answer
55 views

SQL 2008 Cluster Install, “Cluster shared disk Availability Check”

I am trying to setup a new sql server 2008 cluster, on windows 2012R2, and the installer is failing on the cluster shaed disk availability check. I have verified that there are 5 disks assigned to "...
0
votes
1answer
207 views

Adding time slots through trigger SQL Server

I am quite new to SQL. I am now working on something to schedule appointments. I found an existing answer about time slots, but did not quite understand. I need to automatically add time slots to the ...
0
votes
2answers
29 views

How Can i Update only one Column of SQL Table via store procedure with passing rest column value null

Here is What i Have tried. I Have created a Table [tblUser] which allow null value and a Store procedure [spUpdateUser] with All Parameters which can be passed null except ID parameter Whenever this ...
-1
votes
1answer
265 views

cannot read property user access. this property is not available on sql server 7.0

I want to know the .mdf file path from property tab of a db, but it was throwing error as cannot read property user access. this property is not available on sql server 7.0 Note : on querying my ...
0
votes
3answers
64 views

How I would I break a total count query into intervals?

For example, if I did a normal count query like: select status, count(*) from customers group by status and get the result status count ----------------- open 1200 closed 1002 but I want ...
0
votes
0answers
249 views

SQL Login using BCP, trying to queryout to network folder

This is the query I'm trying to run with a SQL Login: exec master..xp_cmdshell 'bcp "Select Linha From ##Global_Table Order By Id" queryout "\\Network_Patch\Network_folder\My_File.TXT" -c -S ...
0
votes
1answer
89 views

How to group records by a two-value column ignoring small gaps?

I have a subquery with a column named code that only has 1 and 0 values and an ID column because I query a lot of codes for each ID. I want to group by said column (and by ID) and by ocurrence but ...
0
votes
0answers
32 views

migrating instance from 2008r to 2016 Enterprise [duplicate]

i have a client that wants to migrate his data to sql server 2016 . currently they have 2008r and the databases are huge(total of 4 tb) on the instance. what is the best way to performe this with the ...
3
votes
2answers
90 views

How Do I Force Data From First Table to Display

DB: SQL SEVER 2008 I'm joining multiple tables and I want the results to always show the data from the "Project" table. In the example below, I have a client where billing and discount data is in ...
4
votes
0answers
70 views

Moving a very large (40 TB) DB from a 2008 server to a 2016 server [duplicate]

The Situation: Our 2008 MSSQL server is old and rapidly running out of drive space. We have a new 2016 server ready, we just need to move a 40 TB database from the old server to the new one. The DB, ...
2
votes
1answer
45 views

SQL 2008/R2 Extended Events - Row Count

I need to setup a sql audit to capture all queries running on a server from any unauthorized locations, and one of the columns that is required is Row Count. In sql trace, this is possible. But I can'...
0
votes
0answers
114 views

Recover data from .mdf file, and no correct version of SQL Server

I have an 80gb .mdf file that I need to open and get the data out of. It was on a computer running SQL Server 2008 R2 Express that died, but I was able to pull the file off the half dead HDD. I don'...
5
votes
0answers
178 views

SQL Server Profiler: why the RPC Starting event does use an different decimal separator from SP Starting?

Trying to diagnose an problem, I've ran into that inconsistency. In SQL Server Profiler, the RPC Starting event uses the regional settings to write real numbers (example: in Portuguese(Brazil) 14.5 ...
3
votes
1answer
651 views

Why is my database using Partitioning? ( I know it's not )

Running this query: select * from sys.dm_db_persisted_sku_features Shows me that I'm using Partitioning: | feature_name | feature_id | |--------------|------------| | Partitioning | 200 | ...
0
votes
0answers
53 views

Taking 36 hours to recover after restart

The last 2 times this database has restarted it's taken 36 hours+ to perform a recovery. We will check to see if it has many VLF's and attempt to shrink once it's online, but to get it online asap, ...
1
vote
1answer
1k views

Two-step Replication between SQL 2008 and 2017

I am currently using transactional replication from several SQL 2008 publishers to a central 2014 subscriber/distributor. I need to replicate this data to a 2017 server, which would require a 2017 ...
0
votes
1answer
402 views

why my split string functions are not working with large OBJECT_DEFINITION?

I have in one of my databases a stored procedure called PROCEDURE [repl].[usp_upd_repl_out_application], that is not exactly a very clever stored procedure but it has over 389 lines. As I need to ...
1
vote
0answers
47 views

Get the records matching the combination of column values from a temporary table

I have a temp table with 4 columns question_tbl: TempTable -- combination to lookup id | Code1 | Code2 | code3 --------+----------+-------------+--------- 111 | AA | A1 ...
0
votes
1answer
112 views

How can I create a stored procedure of inheritance tables in SQL Server [closed]

I have three tables create table CustomerTypes( CustomerTypeID int primary key identity(1,1), CustomerType varchar(11) ); insert into CustomerTypes(CustomerTypeID,CustomerType) select 1, 'Regular' ...
0
votes
0answers
14 views

Migration of SQL 2000 to SQL 2008R2 [duplicate]

How to migrate SQL 2000 to SQL 2008 R2, what would be risk and mitigation and what are the query changes would be required?
0
votes
1answer
307 views

Unexpected Shutdown affects SQL Server DB start at OS start up

I have an application that uses a sql server db (SQL Express 2008 R2) and starts when Windows OS starts. When the pc shutdown unexpectedly and then restart the pc the application run automatically but ...
0
votes
2answers
7k views

Where to download Sql Server 2008 R2? [closed]

I need to do a fresh install in a lab environment. Where's a good place to download it?
11
votes
2answers
2k views

When is the SQL Server database ready to accept queries?

In the SQL Server error log file I found the following lines: 2018-02-22 14:10:58.95 spid17s Starting up database 'msdb'. 2018-02-22 14:10:58.95 spid16s Starting up database 'ReportServer'. ...
0
votes
1answer
574 views

SQL Server Failover Cluster setup shared drive issue

I'm trying to complete an SQL install on a two node cluster which has three LUNs assigned from Filer storage present and currently owned by the first node. I've selected the "New SQL Server ...
1
vote
2answers
105 views

How can I get Sql Server 2016 on a 32-bit server?

I didn't build it, but we've got a 32-bit Windows Server 2008, with SQL server 2008 and 4GB of RAM. I need to upgrade it to SQL Server 2016 in order to log ship to a new server, so we can put this ...
1
vote
2answers
33 views

Best way to allow update exceptions on a cell level

I've got 2 tables, a base table - tBase - and a holding table used to update that base table - tUpdate. (Note: actual tables will have around 25 columns) Table tBase ID | name | type | color ...
0
votes
1answer
144 views

Error occur during Oracle and Sql Server Integration

I have developed a SQL Server Integration Services package pulling data from Oracle 11g and storing in a SQL Server 2008 database. Everything works as expected, but when I schedule a sqlserver job to ...
0
votes
1answer
75 views

DBCC CHECKDB last good date

SQL Server 2014 Standard. Using Ola's (blessings be upon him) scripts to perform database integrity checks: Job command: sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d master -Q "EXECUTE [dbo].[...
5
votes
1answer
186 views

Why does this CTE return the bulk of its results immediately, but then take several minutes to finish?

I've got a schema roughly like this (this is a simplification of my actual schema): CREATE TABLE foo ( key1 NUMERIC(6) NOT NULL, key2 VARCHAR(32) NOT NULL, val VARCHAR(255) NULL, ...
0
votes
0answers
19 views

SQL Server 2008 CPU Troubleshooting on 6 identical servers

We offer an API service that rotates between 6 identical SQL Servers on a "round robin" rotation. I'm trying to troubleshoot some high CPU usage on one of the 6 servers but have hit a wall. All of ...
0
votes
1answer
169 views

Unable to remove additional tempdb file

In our production DB, we only have 1 tempdb file and it had ballooned to 180GB. I ran: Alter Database tempdb modify file (name='tempdev', size=30gb); to resize the primary file, and then ran ...
0
votes
1answer
25 views

Generate a file or a script that can be used to reconstruct a database on a different PC

I'm trying to copy a database that I created in SQL server 2008 on a new PC without having to do so manually by creating a database on the new computer and recreating all the tables from the scratch. ...
0
votes
2answers
334 views

Dynamic select column name on the basis of a flag

I have a config table where there are config values are stored as key, value pair in each row. And there is another table which have two columns (lets say column1 and column2). Now I have to select ...
-1
votes
0answers
430 views

Old SQL Server 2008 DB -> SQL Server 2016 Server Backup/Restore Stuck in “restoring”

This is well documented everywhere and there are all kinds of great "one liner" fixes, and NONE of them work. We are seeing this issue consistently. The database we are backing up was a SQL Server ...
0
votes
1answer
337 views

Unzip files within the SQL Server [closed]

I need to unzip some files. I can do it with xp_cmdshell using 7z (since it is free) but I need this procedure to be able to run on multiple machined and I cannot guarantee that all of them will have ...
2
votes
2answers
741 views

Sum purchased & sold quantities for all items on daily/weekly

I have 4 tables Items, DimDate, Purchase and Sales for items definitions, calendar table, purchased and sold Items respectively. Tables structure here I need to outer join sum(Purchased_Qty) and sum(...
0
votes
1answer
37 views

Correlating hostname/IP to user

I work in an environment where logins are shared among applications, and occasionally developers - in a situation like this, I am having trouble determining who is connected to the database, or who is ...