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

learn more… | top users | synonyms (2)

0
votes
3answers
89 views

How to read and increment a number in text file using TSQL

I have a text file C:\abc.txt with a number 5 in the first line. I need to increment it into 6. Please help me with the T_SQL syntax. I have tried the following query to read the value but not able ...
2
votes
0answers
67 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 ...
-3
votes
0answers
39 views

Procedure taking so much time [closed]

Can anyone help me out. This is first time im working on performance tuning can anyone help me out. If want i can paste the proc also.
2
votes
2answers
80 views

T-SQL SELECT use multiple indexes for no reason

I have a question about indexer and execution plans in T-SQL. My database is SQL Server 2008. I have a simple three-table db schema: The InverterData table is very large and partitioned ...
2
votes
2answers
183 views

SQL Query is getting progressively slower

We are experiencing a very weird problem when making consecutive query calls. Not sure what info is important, so I will give as much info as I can. We have a webserver and database server through ...
0
votes
0answers
31 views

SQL Server 2000 Migration on Production [duplicate]

I have a couple databases on server1 and I want to put them on server2. Application is adding new data in every couple of minutes to databases on server1. I would like to not switch off application ...
-1
votes
1answer
54 views

The Database zzz is not accessible

I have a SQL Server instance which has several Database in it. I had to restart the server, after restart one of the databases would not launch and I click the + Icon besides it, it says The ...
0
votes
1answer
49 views

Verify this TSQL to find the indexes fragmented over 50%

select OBJECT_SCHEMA_NAME(IPS.object_id) 'schema', OBJECT_NAME(IPS.object_id) as table_name,index_type_desc, round(avg_fragmentation_in_percent,2) 'avg_fragmentation_in_percent', si.name ...
0
votes
2answers
52 views

Insert Data in seconds between 30 minutes time interval [duplicate]

I want to divide my time interval from the start time to end time. The elapsed time should be divided across 30 minute time intervals so that for this input 08:05:13 12:09:49 I should get ...
1
vote
1answer
52 views

How can I get the whole execution log of stored procedure?

I know that how many times it was executed from execution_count in sys.dm_exec_procedure_stats.But how these values are Calculated? Is there any way to know how these values get calculated? I want ...
-2
votes
1answer
46 views

Backup file from SQL Server 2012 to 2008 [duplicate]

I have a backup file of SQL Server version 2012 but I want to restore that backup on SQL Server 2008. Question: Is this possible ?
4
votes
2answers
93 views

Can't get any fragmentation of index for testing in SQL Server database

I am filling my table in my SQL Server database with some data and I have partitions. I have one clustered index in the table. The problem I am facing is that I am not getting any fragmentation which ...
0
votes
1answer
33 views

Conditional loop date lookup SQL Server 2008

If I have two tables, first one is WorkTime: ID EmpNAME Hours/Day Date0 1 Mark 7 2015-12-01 2 George 8 2015-12-01 3 Jennifer 6 2015-12-03 4 Mark ...
2
votes
1answer
63 views

SQL Server 2008 - SIMPLE database log file is HUGE relative to the actual DB?

So... I'm not a SQL Server DBA but was asked to look at a customer's situation where they have a 2GB database that has a 60GB transaction log. I've read up on a whole lot of articles on the web (Aaron ...
-7
votes
2answers
115 views

difference between two rows based upon previous difference value in sql server

I have one table like below ID Value 1 5 2 6 3 4 4 3 5 7 6 6 7 8 8 9 Output like difference between rows ID Value difference 1 5 null 2 6 1 3 4 -2 4 3 ...
7
votes
2answers
125 views

Transparent Data Encryption

Are there any best practices when configuring TDE in SQL Server 2008? On SQLMag, the article "Transparent Data Encryption FAQs" says the CPU may have increased usage by up to 30%? Other than adding ...
-3
votes
1answer
72 views

Unable to connect to SQL server 2008 R2 via computer name [closed]

I wrote a program, on my computer it works correctly because SQL Server us running on my computer, but another computer in the network can't use the database. Here is the definition of the connection ...
0
votes
0answers
18 views

Shrink Database in SQL Server [duplicate]

I have 700 GB database and I want to shrink it. What are the risks of this operation and my data will be deleted during this operation ?
2
votes
1answer
24 views

Detail of all transactions on a specific row

I've a User table and It's data can be added/ updated from a User Screen. I want detail of all transactions on any row. For example, I have data in table like this Name - Age - Salary ...
-2
votes
0answers
64 views

SQL Server Management Studio Has Stopped Working [closed]

I was executing a large script and suddenly the Sql Server had crashed, after that I tried to run the SQL Server Management Studio, but was getting the mentioned error. I even tried to repair the SQL ...
5
votes
2answers
116 views

Can sp_executesql be configured / used by default?

I am looking at an application that uses highly dynamic sql queries against SQL Server. Looking at the queries that are constructed in very weird and complicated ways, but that's a different story, I ...
1
vote
0answers
30 views

Why am I getting this network error when setting up database mirroring?

I have two servers, one in the Portsmouth, NH datacenter, one in the Kansas City datacenter, same domain. Trying to set up mirroring. First, does it matter that one server has Windows 2008R2 server ...
6
votes
2answers
677 views

Is ELSE 0 implied in my COUNT CASE WHEN statement?

What's the difference between COUNT(CASE WHEN [Column A] = ____ THEN 1 END and COUNT(CASE WHEN [Column A] = ____ THEN 1 ELSE 0 END? I've been using the former and I haven't seen the difference thus ...
3
votes
1answer
39 views

Clarification on Database Replication

SQL Server 2008 I have to do database replication which is a new for me. Goal is have mirror database on servers 2 and 3. When we set up database replication in the Server 2, 3 from Server # 1, ...
0
votes
1answer
48 views

SQL Dependent Percentage

Sample data Excepted output Math Operation Sum all Period time for each EmpName as Total Employee Time Sum Similar Tasks For EmpName, divide it by Total Employee Time and multiply by 100% ...
4
votes
2answers
120 views

MSDB log file size

We have a SQL Server 2008 cluster with 60 databases. Full backup runs every night, log backup runs every 15 minutes. The MSDB database recovery model is set to simple (default). To be able to see ...
2
votes
2answers
40 views

simpler way to write if today or tomorrow is between ColA or ColB

SELECT * FROM my_table WHERE getdate() between SPRFRDTE and SPRTODTE or dateadd(DD, 1, getdate()) between SPRFRDTE and SPRTODTE is there a way to write this as if TODAY or TOMORROW is between ...
2
votes
1answer
45 views

SSIS export to flat file - how to configure all DataTypes for columns w/o manual entry?

In my OLE DB Source to Flat File Destination Data Flow, I have quite a few columns and it's excruciating to manually set each one to decimal with a scale of 4. I tried adjusting my SQL code in the ...
-8
votes
1answer
76 views

FULL OUTER JOIN much faster than UNION ALL in SSMS, but slower in Excel [closed]

I am trying to optimise a view pulled from SQL Server 2008 to Excel, and I've managed to drastically improve the performance on SSMS. Using FULL OUTER JOIN instead of UNION ALL, I've managed to ...
0
votes
2answers
88 views

SQL Job Fails - Why?

This is my log - if I run the procedure locally it will still perform as it should and generate the message, but when it is run as a SQL Job it fails. (For security I have changed the server name and ...
0
votes
0answers
12 views

List All Stored Procedures that Query Specific Table [duplicate]

I am using this syntax, and it returns no stored procedure names (however I know their are 2 stored procedures that query the table). This is SQL Server 2008 and this is my syntax: SELECT DISTINCT ...
4
votes
4answers
60 views

How do I fix an Orphaned User in Log Shipped version of a SQL Server 2008 database

Forgive my greenness.. but would appreciate some help on this... We are doing development work on an instance of SQL Server 2008 and have multiple databases on that server that are core to our ...
0
votes
1answer
23 views

SQL Server authentication failed after server promote

we recently promoted a Windows 2008R2 server to domain controller. We then found that it hosted a SQL Server 2008R2 Express database instance. If we try to login to the DB with the domain admin ...
1
vote
1answer
86 views

Sum of time spans

I have table like that Code Time Value RowNum -------- ----------------------- ----------- ------- I370902P 2015-12-04 09:00:00.000 5.0 1 I370902P 2015-12-04 ...
1
vote
1answer
29 views

SQL Server 2008 running schema query without identifiable cause

I am analyzing the performance on login to an application and in particular making sure the database response is acceptable. In running just the simple Activity Monitor I can see that there are two ...
1
vote
0answers
56 views

SqlException (0x80131904): Cannot open database

We keep getting the error SqlException (0x80131904): Cannot open database in our environment. We are sure the connectionstring used is correct. The user has the necessary permissions in the database ...
-7
votes
1answer
47 views

Need Immediate Help To Develope T-SQL

Hi DBAs, I want to Develop a T-SQL For Fetch data from following Table. But Condition is : I want to select only those data which status has all three status. suppose for id 1 : It has Only two ...
0
votes
0answers
14 views

How to move SQL Server to a different domain [duplicate]

I am new to data base usage and I want to know a simple steps on how to move an application server to a different domain without losing any data. Right now I'm not very good with SQL but I want to ...
3
votes
0answers
28 views

Network Traffic increase with Small Result Set

I am currently executing a stored procedure that is using up a ton of network traffic when it executes. The stored proc executes multiple stored procs within itself as well as functions and ...
7
votes
1answer
164 views

Can I recover a SQL database from Standby/Read-Only without a standby file?

Is there any way to recover a SQL database from Standby/Read-Only mode if the "standby file" is missing? (I see some references calling this a TUF file in a log-shipping scenario, but in my case, it ...
1
vote
2answers
46 views

SQL Query to find Records companywise

I want a query that will display rows of those COMPANIES who are giving theft cover and key loss Having status is yes See the Sample Data below : addon status amt1 amt2 company ...
3
votes
1answer
52 views

Are database connections from an application expensive from a performance point of view?

A colleague tells me that connections to a database are expensive and could harm performance of the application. They ask me to create a procedure that calls say another 8 procedures, that way they ...
0
votes
0answers
21 views

Broken partition function/schemes

The dilemma SQL Server 2008 Enterprise 2 partition schemes using the same partition function partition function splits on date column, monthly basis maintenance script to split partition function ...
0
votes
1answer
60 views

MSSQL how do I query sql for a latest state record after latest date

I have a table with openingdays, location, state (Open, Day Closed, Shift Closed) and the actual date. I would like to know when the day is closed for the last time (state = D) and everything what ...
3
votes
1answer
130 views

SQL to Find Partial Duplicates of a Field

I have a table with a field for a member number. The table can contain records with duplicate values for this field and does. I have a SQL query that will obtain any duplicate values for this field, ...
0
votes
0answers
25 views

Rowlock hint is doing Lock escalation at table level. i dont know why.? [closed]

I want to first do select to read rows and then do some calculations and then finally update the read row. So my transaction will be in 3 steps: select the records (In this session only allow other ...
1
vote
0answers
42 views

Window function vs group by method: find value for MAX ID

I'm trying to understand the performance issue with Window function when i select value for MAX ID --Old group By method SELECT tj.MainProcedure , tj.StartTime , tj.EndTime , ...
0
votes
0answers
27 views

Do both the sessions need to have UPDLOCK to avoid deadlocks

The benifit of UPDLOCK is that it avoids deadlock in case both sessions run the below query at the same time - The table has clustered index on ID column ----session 1 -------- begin transaction ...
0
votes
0answers
30 views

SQL Server: Update linked table times out

I have 4 linked SQL Server 2008 R2 servers in the same network, and distributed selection queries works fine. However when I try to run something like that: UPDATE [LINKED SERVER NAME].[DB ...
1
vote
1answer
35 views

Setting up SQL Server to handle queries from external domains

I am not a SQL Server admin. I have tried to google this but can't seem to use the right words to get the right info and they all talk about remote connections to a SQL Server in terms of admin and ...