This tag is for SQL Server 2008, major build version 10.00.xxxx.

learn more… | top users | synonyms (2)

0
votes
1answer
25 views

Dynamic Filters in SQL server

I have problems with my dinamic filter in 'sql server'. My problem is that the filters aren't working. When I try to execute the store procedure I just get all the data without filtering. I'm new ...
1
vote
1answer
149 views

how to group data against more than one conditions

I have a table named Employees with below two columns. ================== Employees 1- EmpId (auto incremental id) 2- EmpName (varchar) There is another table named 'LateDays' with below five ...
0
votes
0answers
18 views

Create an AD user from a SQL Server trigger

Running SQL Server 2008 (10.0.5520) - I have a trigger that is executed when a new record is added to the security table. I would like to extend this trigger, and create an entry in the AD system with ...
0
votes
2answers
45 views

Select statements during long update

I've a table MESSAGES id (long) | attach_data (image) | ins_date | flag this table contains all messages of my application. During night, my job cleans old attach_data with query update messages ...
0
votes
1answer
1k views

SQL Server to MySQL sync, using Workbench, FreeTDS, and iODBC on 10.9

I've been struggling to get the MySQL Workbench to behave properly to complete the following: With Mavericks (OS X 10.9), connect to a SQL Server and create a migration job to a MySQL server. The ...
0
votes
1answer
225 views

Delete files from disk, with a job, respecting some rules ( SQL Server 2008 ) [on hold]

We have An application that our customers use to download and upload files. I need to delete these files from disk after 30 days, of if it was downloded, in 7 days. How can i Use the script below, ...
3
votes
1answer
60 views

Problem with clustered index? Or bad indexes? (SQL Server 2008 R2)

I have this query (it was running in 2 minutes). With new indexes, it takes 40 sec: select Top 30 codCliente from (select t1.CodCliente, codcampo, valor, t1.chavealeat from ...
0
votes
1answer
937 views

syspolicy_purge_history job failed at step 3

In one of my SQL Server 2008 sp1 standalone instances, syspolicy_purge_history job is fails at step 3 Erase Phantom System Health Records. Below is the command - (Get-Item ...
3
votes
0answers
40 views

Very high transactions per second

Our production server runs on average 4,000 transactions per second. In the past few days the average has jumped to 175,000 transactions per second. That is not a typo, it's 175K per sec. Looking at ...
5
votes
2answers
6k views

How to refresh AD security group on Sql Server permissions

I am using Sql Server 2008 on Small Business Server 2003; client is using WinXP. I added a user to my Active Directory Security Group; Why can't this user immediately access the database? It seems ...
1
vote
1answer
61 views

Should I update to sql server 2008 sp2 before restoring the db's or do the update after?

I'm making a move from SQL Server 2008 to SQL Server 2008 R2 (Azure VM) as part of a hosting provider switch (from MyHosting to Azure). Should I update the VM to R2 SP2 before restoring the db's or do ...
4
votes
1answer
524 views

Cannot Delete FileStream Group from Sql Server 2008

We have migrated all our varbinary(max) column data to Azure Blob Storage and so we want to remove the old filestream columns that remain in our Sql 2008 database and the filestream filegroup but when ...
2
votes
2answers
33 views

will table partitioning and compression help heavily used OLTP database?

We have a very big table which is over 300gb with over half billion rows in it. This table is used for audit purpose for all critical applications. A lot of inserts are happening per seconds. Due to ...
0
votes
0answers
14 views

Migrating from SQL Server 2005 (Win 2003R2) to SQL Server 2008R2 (Win 2008R2) new Server [duplicate]

I am pretty new to the DBA field and i have been assigned to migrate all of my Production database from SQL server 2005( server A) to 2008R2 (Server B) and Decommission all of those database from 2005 ...
0
votes
1answer
102 views

Automate SQL Server restore from Prod to Dev

I would like to setup an automated restore job which takes the latest timestamp .bak file and restores it into the DEV instance. I currently have a job on the DEV box that uses the UNC path to the ...
0
votes
1answer
900 views

How to generate replication snapshot without locking tables

When I reinitialize subscription and generate new snapshot it locks all tables and makes the database unusable for a very long time (never waited it out). Is there anyway to do this without locking?
1
vote
1answer
23 views

SQL Server restore database file access error

I am trying to restore a database from a file on a remote machine. The script I am using is as follows: RESTORE FILELISTONLY FROM disk = '\\server\path\to\file.dmp' RESTORE DATABASE MyDB FROM ...
7
votes
2answers
1k views

SQL Server 2012 Availability Group is it “AlwaysON”?

In a traditional SQL Server cluster when failover occurs, all clients that are connected to the SQL Server failed instance lose connections and each client must re-establish a new connection to ...
1
vote
2answers
288 views

SQL 2008 Server - performance loss possibly connected with a very large table

We have SQL Server 2008 with 3 active databases running on it. DB1 - cca 400 MB size DB2 - cca 8 GB size DB3 - cca 42 GB size - but the majority of records are not used at all In DB2 we have a ...
1
vote
2answers
58 views

SQL Server : Tracking a slow running query on completion

Am trying to work on script for slow-running queries. I understand that we can get the list of slow running queries using sys.dm_exec_requests. Say, I have a query Q1 which is running very slow, say, ...
2
votes
4answers
5k views

How to find all positions of a string within another string

How can I find all the positions with patindex in a table or variable? declare @name nvarchar(max) set @name ='ali reza dar yek shabe barani ba yek ' + 'dokhtare khoshkel be disco raft va ali ...
3
votes
2answers
205 views

Only show results greater than a certain number when summing two values together

I have a query that sums up two values in the same table and then calculates one as a percentage of the other select account_no, 100*((sum(COMMISSION/100)) / (SUM(AMOUNT/100))) from accounts etc ...
-3
votes
0answers
15 views

sql query for interchanging rows and columns [closed]

My data looks like: orderA file1 file2 file3 file4 file5 orderb file7 file8 file9 file10 file11 I want output as like OrderA file1 file2 file3 ...
1
vote
3answers
190 views

How to get the first or last row in ordered result set, depending by column value?

I have the follwoing result set from the table PUNCHREPORT EMPLID Name PUNCHDATE PUNCHTIME DEVICETYPE .................................................................. 70 ...
0
votes
0answers
14 views

Combine multiple same rows into one row by using Id

This is my table: ID Contact Id Ad-type Ad-Title Images_Path 1 2 Houses For Sale lands/im1.jpg 2 2 Houses For Sale lands/im2.jpg I need output like this: ...
6
votes
1answer
8k views

Add DEFAULT to existing column

In Microsoft SQL server, how can I add/change the default on an existing table column using T-SQL?
2
votes
3answers
1k views

Twice job results in sql server, last one is left in progress

I have the job MP - Create CSV which execute a package SSIS in sql server 2008, when I check for the job history I see the result at step 0, I expand and I have 2 results for the step 1. Fist result ...
2
votes
1answer
22 views

Hosting SQL Server and SSIS/SSRS in same VM

I have SSIS / SSRS and large number of databases currently being hosted on the same prod server (SQL1, SQL Server 2008R2). Since SQL1 already has SSRS/SSIS installed, would it be a good option to ...
1
vote
2answers
183 views

Why does FETCH NEXT return second row after opening cursor?

I have a cursor declaration: DECLARE idCursor CURSOR FOR SELECT DISTINCT [id], [data] FROM #tempRemaining OPEN idCursor And the statement: SELECT DISTINCT [id], [data] ...
9
votes
3answers
42k views

How to handle TimeZone properly in SQL Server?

My local development server is in the Middle East, but my production server is in the UK. I need to show the date to the user in their time zone. For example, if a user is in Saudi Arabia then I ...
10
votes
5answers
18k views

How to detect any changes to a database (DDL and DML)

There are a lot of databases on my client's sql server. In common, these databases is under development, so developers can design, refactor, do data modifications and so on. There are some databases ...
0
votes
0answers
21 views

Linq Query Optimization [closed]

Urgent,I am really in trouble. can anybody help me? my query is slow: I have created a view in sql server containing nested loops like this: Tis is my view: SELECT dbo.VE.V, dbo.VE.Operation, ...
6
votes
4answers
2k views

How can I detect broken stored procedures after a schema change?

I've modified a central table in my database, and sp_depends literally returns hundreds of results, and I'm concerned some of those stored-procedures might not compile anymore after my change. ...
0
votes
1answer
180 views

Select Query takes more than a minute to retrieve data

I have a table that has 99 columns, all of them are not needed but they were there when we started. There is a Primary Key (Objectuid) which is a GUI and has the Clustered Index on the PK. The Table ...
12
votes
1answer
427 views

What is the cause of this problem with CONVERT()?

Consider the following two statements: PRINT CONVERT(NUMERIC(38, 0), 0x0100000001, 0); PRINT CONVERT(NUMERIC(38, 0), 0x0100010001, 0); Both statements return -1; isn't that incorrect since the ...
21
votes
4answers
85k views

Restore SQL Server 2012 backup to a SQL Server 2008 database?

Is there a way to restore a SQL Server 2012 database backup to a SQL Server 2008? I tried to attach file, it does not work.
4
votes
1answer
13k views

How can I get my linked server working using Windows authentication?

I'm trying to get a linked server to ServerA created on another server, ServerB using "Be made using the login's current security context" in a domain environment. I read that I'd need to have SPNs ...
0
votes
1answer
14 views

Do we have logging feature for SQL AUDIT like we have it for transaction and error logs in SQL server 2008?

Do we have logging feature for SQL AUDIT like we have it for transaction and error logs in SQL server 2008 ????
4
votes
2answers
18k views

SQL Server 2008: The database [dbName] is not accessible

I got this error from another person and I've run out of ideas. I can access this database without any problems, the database is in MULTI_USER mode, the person receiving the error is a user, etc. The ...
1
vote
1answer
44 views

microsoft sql server schema [closed]

From blog.sqlauthority.com: Protecting ISV database access: in custom ISV (Independent Software Vendor) applications, the database schemas are usually complex, and in the case of applications such ...
12
votes
1answer
881 views

Best way to write SQL Query that checks a column for non-NULL value or NULL

I have a SP with a parameter that has NULL as default value and then I want to do a query like this: SELECT ... FROM ... WHERE a.Blah = @Blah AND (a.VersionId = @VersionId OR (@VersionId IS NULL AND ...
3
votes
1answer
573 views

SQL Server 2012 Publisher SQL Server 2008 Subscriber version issue

So I have a setup where one virtual machine is a SQL Server 2012 publisher and I need to setup merge replication on a SQL Server 2008 subscriber on a different vm. When setting up the subscription ...
0
votes
0answers
21 views

What is the syntax to sp_recompile logon trigger?

I would like to recompile my logon trigger using sp_recompile. But I can't figure out the syntax. E.g. these don't work: sp_recompile '[Tr_Logon]' sp_recompile '[Tr_Logon]' ON ALL SERVER ;)
2
votes
0answers
35 views

Server Logon Trigger fails after deleting many records in “Logon-Table” -SQL Error 2801

We have a server logon trigger defined that logs every login with information like windows/sql user name, client and time in a table. The table doesn't have clustered index, but it does have a ...
2
votes
3answers
61 views

updating the entire column with datetime values based on other values in the row

I have a very large table [server].[dbo].[MyTable] where I need the SQL statement to fill the column 'ToDateTime' (currently full of NULLs) according to the following logic: Only add a value to ...
1
vote
1answer
28 views

How to update/insert/inject nodes into XML

I have an application which stores optional Site information in an XML field. Sample table: CREATE TABLE [dbo].[Sites]( [SiteID] [int] IDENTITY(1,1) NOT NULL, [SiteName] [nvarchar](80) ...
0
votes
2answers
39 views

How to add deleted user in sql server? [duplicate]

I have set up sql server 2008 in windows server 2008 r2 and it works fine. However, I have deleted the my user from logins in the sql server accidentally and now I cannot find a way to log in to the ...
1
vote
0answers
17 views

Why do async_network_io wait types occur?

Last week something strange happened on our database. All of a suddon, the application blocked for our users which were not able to save new entities etc. After looking at the Activity Monitor of the ...
2
votes
1answer
296 views

How to include concatenated values in a dynamic pivot column value?

I am extending a dynamic pivot query. The original query works fine. In the second query, instead of displaying the date as a value for the pivot column, I would like to display a concatenated column. ...
0
votes
0answers
9 views

Are tables during a merge function updated dynamically?

If for example, I have a column age in both tables. My merge condition for two tables is when table1.age=table2.age. My WHEN MATCHEDinstruction is to increment table1.age by 1. So if a row with age=5 ...