We’re rewarding the question askers & reputations are being recalculated! Read more.

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
991 views

How to find Linear interpolation without using pivot and unpivot in SQL Server 2008

id x val ------------- 1 1 8.18 2 3 8.35 3 5 8.51 4 7 8.52 5 10 8.54 6 15 8.57 7 1 8.35 8 3 8.60 9 5 8.70 10 7 8.75 11 10 8.76 12 15 8.82 13 1 8.55 14 3 ...
1
vote
1answer
327 views

How do I determine the time period to which the SQL Server i/o warning is referring?

SQL Server log shows batches of warnings, of the type: SQL Server has encountered 18757 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [T:\.. SQL Server has ...
3
votes
2answers
327 views

Can a diagram be created from deadlock xml extracted from the ring buffer in SQL Server 2008?

In later versions of SQL_Server, we view the event file in the object browser to look at deadlock diagrams. This particular client has SQL 2008 (compatibility 2005) and the only copy of deadlocks have ...
3
votes
2answers
445 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 ...
0
votes
2answers
2k views

UPDATE trigger causes deadlock

I have a After Update trigger where trigger insert a value in same table to find a duration column.My goal is whenever end_time value is inserted then trigger will find duration in hh:mm:ss format and ...
1
vote
1answer
79 views

Is there a way to check which computer or IP used a particular script?

As the Title suggest, is there a way to check what IP used a particular SQL Script? The scenario is, there is a recreation script in a email and we hypothesize that somehow, that recreation script ...
6
votes
1answer
724 views

Why can't the transaction log shrink during a backup?

I have a large database in Simple recovery model (vendor requirement) and it took 3 days to back it up to the new hosting company's server. The morning of the third day, the DB went offline because ...
0
votes
1answer
26 views

How are they calculating “AssignmentBaseline0Work” in this query?

I just wanted to understand how they are calculating "AssignmentBaseline0Work". (SELECT ProjectUID, CAST(MAX(CAST(TaskUID AS nvarchar(36))) AS uniqueidentifier) AS TaskUID, AssignmentUID, ...
0
votes
3answers
120 views

Odd behavior of between operator when updating

I have to maintain FRP (Financial Resource Planning) Software that was implemented by some shady consultants (they came up with the jobs), and it stores the data in a SQL Server database. The software ...
-1
votes
1answer
2k views

Rewrite query to not use CONCAT function in SQL Server 2008 R2?

I know that the CONCAT function does not exist in SQL Server prior to 2012. How would i optimize my code to not use the CONCAT function? SELECT dbname = DB_NAME(), ...
0
votes
1answer
1k views

Specifying the IP address to be used when connecting to an instance

I have an application that was compiled with a hard-coded connection string (using the server's IP address '192.168.40.201' and not the server name) to an SQL Server. A backup of the database has ...
3
votes
1answer
1k views

Pivot with rollup in sql server

Is it possible to use a cursor to create a dynamic table and then use those columns to aggregate data in SQL server 2008? For example take the following table. CREATE TABLE Billing ( BillingId ...
1
vote
1answer
1k views

SQL Server Agent Alerts using severity 16

My work is currently deleting lot of stored procedures, views, tables and so on. My worry is that if we miss judge a object and it goes into production that we'll only catch the errors when an user ...
1
vote
1answer
119 views

Two Inner join on the same field to get same data

I'm developing a Report in SSRS for MS CRM 2011. There is a table named StringMapBase which contains Option Set we have declared in different entities. This table has Value and AttributeValue column. ...
-3
votes
1answer
37 views

Sql 2008 r2. Nvarchar(50) how many size does it consume on the Hard drive [closed]

im trying to build a program with so many transaction and inputs. the columns is only nvarchar(50). i want to know how much size does it consume in my hard drive?
2
votes
1answer
207 views

When is autoclose OK to be not OK

By chance, I happened to see that the autoclose feature on SQL dbs (I'm using SQL 2008) shouldn't be on and I found that all of my SQL dbs were set to have autoclose on. I've set autoclose to off on ...
0
votes
0answers
1k views

Login failed for user '<mysqllogin>'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] issues

Over the last 10 days or so, I've started to get 'Login failed for user ''. Reason: Failed to open the explicitly specified database. [CLIENT: ]' entries nearly every 5 mins in my SQL 2008 logs and I ...
5
votes
1answer
461 views

Getting year DATEPART from Unix date

In my database, the dates are retained as days elapsed since/before 01/01/1970, which I understand to be a Unix date format, eg. today is 23rd May 2018 and the value is 17674. I'm trying to run a ...
0
votes
2answers
2k views

Combine date and time into one new column

I have two columns named date and time respectively. Both of them have datatype nvarchar as they were imported from ms excel. I want to combine the column into a new column named datetime. I managed ...
0
votes
1answer
339 views

Adding Time Limit parameter to Ola hallengren Index Maintenance

I would like to limit the duration of the index maintenance procedure of Ola Hallengren to be 7200 seconds (2 Hours) I found parameter TimeLimit defined as: Set the time, in seconds, after which no ...
0
votes
1answer
102 views

Index Reorganize During Database Full Backup

Index maintenance usually starts 3 hours before the database full backup and ends before the full backup start. The database is using the Simple Recovery model. Last weekend the index maintenance ...
1
vote
1answer
694 views

Creating the same unique ID in multiple tables

I have two tables of data; one table is the Employee Master table containing a list of unique employee names, and the other table contains transactional data with multiple records for each employee. ...
2
votes
1answer
54 views

Trying to replace a cursor with update statement, went wrong somewhere

I have a cursor im trying to rewrite into a single update statement. When comparing the results, I get 280 records that are being copied over with the cursor but NOT copied over with the update ...
-2
votes
1answer
744 views

Compare all 70 columns from two tables in same database

I have two tables with 70 columns each and they have same columns names in each table. I want to compare the data of every column and the output is number of rows which are different of every column. ...
1
vote
2answers
317 views

Windows Authentication In SQL DTS packages

We have a SQL server 2008 R2 and have legacy DTS packages running on the server. As of now, the subtasks inside DTS packages are using dynamic properties where SQL Login ID details have been given, ...
2
votes
4answers
3k views

How do I select MAX/MIN from multiple tables, along with other columns from MIN/MAX row

I have a query where I JOIN 4 weekly "summary" tables, and SELECT a MIN and a MAX of units FROM each table. This would give me the highest/lowest total units sold for, and I'm pulling an average from ...
0
votes
3answers
103 views

How to remove earliest/latest row by two columns (userId, StatusCheck)?

I have crosschex database that is used to store logged in/out data. Sometimes it happens that user clock in/out few times. I would like to remove that duplicates leaving the earliest when log in and ...
0
votes
1answer
288 views

SQL Server listen on a specific port

I want to change the PORT to 255: can i change per db or just for instance? is there any issue can come up? have to restart the service?
0
votes
1answer
63 views

Replication Monitor - Start Synchronizing grayed out

Having an issue where the start synchronizing menu item in the replication monitor is grayed out for users who have repl_monitor permissions in the distribution database. The weird thing is that it ...
0
votes
1answer
53 views

How to find the time taken to execute a script

As a part of partitioning table,1M records were inserted into a table using insert statement and I forgot to capture the time taken to insert. Is there any way to find out the time taken to execute ...
1
vote
1answer
211 views

SQL Server Agent Service deleted

Has anybody run into the issue where an application (arcserv) using SQL Server Express 2008 is uninstalled on a server running SQL Server 2014? When arcserv was uninstalled, it or user deleted the SQL ...
1
vote
1answer
47 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 ...
0
votes
1answer
10k 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
3k 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
192 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
3k 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
1k 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
478 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 ...
1
vote
1answer
1k 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
925 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 ...
2
votes
3answers
55 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
49 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
466 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
67 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
455 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
44 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
412 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
128 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
1answer
482 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 ...