Questions tagged [sql-server]

All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag, like sql-server-2016, since it is often relevant to the question.

Filter by
Sorted by
Tagged with
28 votes
3 answers
39k views

Is it possible to restore sql-server bak and shrink the log at the same time?

We have a bak file from a client that we have transferred to our developer offices for problem investigation. The backup is currently 25GB and the restored database is about the same size however it ...
Adam Butler's user avatar
  • 1,531
9 votes
5 answers
11k views

Parallelism Best Practices

What are the best practices with setting parallelism in general? I know that SQL Server defaults to 0 to use all available processors, but in what instance would you want to change this default ...
user avatar
2 votes
2 answers
4k views

Query data from multiple linked remote databases

Using SQL Server 2005 databases and SQL Server Management Studio 2008, I need to query a single value from each of n linked databases at a regular interval. The servers are physically remote and I can ...
Ben Brocka's user avatar
  • 2,063
5 votes
2 answers
86 views

Using stored procedures

I have a task which receives an input and performs a series of tasks on the SQL server, which some depend on the content of the server and on the input. For that I use a lot of selects and then logic ...
user avatar
4 votes
1 answer
3k views

SQL 2000 Maintenance Scripts

Hi I've stumbled into the administration of a Legacy SQL 2000 server that has had next to no maintenance for the past 8 years (and is very slow). As I have only been doing DBA / PT for the past 2 ...
bumble_bee_tuna's user avatar
8 votes
6 answers
14k views

How do you submit a List of items to a Stored Procedure to limit results? [duplicate]

Possible Duplicate: Passing array parameters to a stored procedure Lets say you want to filter results by a List of uniqueidentifiers such that your SQL statement would read: WHERE CustomerID in ...
coder's user avatar
  • 211
10 votes
2 answers
4k views

How does using separate schemas affect SQL Server 2008 performance?

I want to use separate schemas for objects with different purposes in our SQL Server 2008 database. Right now we use a fairly mind-numbing naming convention to indicate the purpose of a table or ...
user avatar
11 votes
3 answers
2k views

SQL Server 2008/R2 recovery model

Pretty much all of our databases on certain servers do not require the Full Recovery model (we don't do transaction log backups) and the default should always be to create databases and specify the ...
Kev's user avatar
  • 1,326
4 votes
3 answers
524 views

How to send+update on duplicate a big time series to SQL server

I use a SQL Server 2008 I would like to send (and update on duplicate datetime index) a big time series (more than 1000 datapoints and eventually much more than that). What is the best way to do so? I ...
RockScience's user avatar
4 votes
2 answers
2k views

Add constraint to ensure flag column is <= sum of column in other table

I have a column RSEFlag that contains a flag value that is the sum of one or more of 1, 2, 4. I have separate table that contains the description of each of those flag values: RSECode RSEDescription -...
David Clarke's user avatar
  • 1,177
6 votes
1 answer
2k views

Mirroring problems after removing domain

I successfully created a mirror with certificates between two servers. One of those servers was a domain controller. After removing the domain the mirror was interrupted. After hours of searching I ...
MichaelD's user avatar
  • 563
1 vote
1 answer
124 views

Can the replicated database be the publisher with SQL Server

I need to setup replication for a Client but their production database server doesn't seem to have the components installed to enable publishing. Is it possible to setup what should be the subscriber ...
eaglestorm's user avatar
7 votes
3 answers
12k views

How to test if a column definition allows nulls?

I have a table with roughly 3000 rows in it and I need to modify a column definition to allow nulls. I have a change script that will perform the change but I would like to be able to re-run the ...
David Clarke's user avatar
  • 1,177
9 votes
4 answers
1k views

DDL contention on TempDB

I have a SQL Server 2005 Standard x64 that is experiencing issues with TempDB DDL contention for the past few months. The server will experiencing contention on wait resource 2:1:103 (the wait type ...
David Mathis's user avatar
3 votes
1 answer
7k views

How to check if subscriber replication initialization has timed out

I've added merge replication to a SQL Server 2005 database and have added a SQL Server 2000 subscriber. Creation of the publisher, subscriber and snapshot creation went fine, but there seems to be a ...
Loftx's user avatar
  • 131
2 votes
2 answers
2k views

Designing a database tables for the following scenario

I just got following entities Employee, Client and Company. Where Employee and Client have one to many relationship with Company ie A single employee may be mapped to attend to many companies and ...
Deeptechtons's user avatar
0 votes
1 answer
155 views

SQL Server Data types and operators clarification needed

I would like to confirm the following with respect to the basic SQL Queries: The float and real data types cannot be used with the equals and not equals operator in sql. If so then what else ...
Saravanan's user avatar
  • 443
35 votes
8 answers
151k views

IntelliSense not working but it is enabled

This problem is really proving to be a tricky one (and quite annoying). In SQL Server Management Studio 2008, up until a few days ago my IntelliSense was working great. Then all of a sudden it ...
Thomas Stringer's user avatar
4 votes
5 answers
17k views

What determines the default schema name in SQL Server?

when I tried to create a table, it is using my ID as the schema name. But when the table is created on my manager's computer, the schema name is "dbo". Why? He might have administrator rights. When I ...
user avatar
3 votes
2 answers
2k views

How can I create a notification method when someone adds a user/login to have ‘sa’ access?

How can I create a notification method when someone adds a user/login to have ‘sa’ access on SQL Server 2005/2008/2008R2? Thanks for your help.
db7's user avatar
  • 1,371
11 votes
6 answers
552 views

Backing up SQL DB more frequently

I currently have a scheduled task that fires off each night at 2 AM that calls SQLCMD.exe and passes it a .sql script to run for the backup (shown below). We're a pretty small company with growing ...
RSolberg's user avatar
  • 213
2 votes
1 answer
6k views

How do I backup SQL Server Agent configuration?

I've tried googling for this. The problem is that the all the results are about using SQL Server Agent to schedule automatic backups. How do I backup the SQL Server Agent configuration itself? If ...
randomfactor's user avatar
2 votes
1 answer
93 views

Bad Windows Authentication sign on

I do not have install privileges on my machine. Another user who has admin privileges installed it, but told the system to use Windows Authentication for the sign on. Is there a way they can change ...
I_AM_JARROD's user avatar
13 votes
3 answers
5k views

Snapshot Replication Retention

I've got Snapshot replication set up on my SQL Server 2008 production server, and I just noticed that there are snapshots ranging back to a year ago in the snapshot folder. How can I change the ...
DForck42's user avatar
  • 3,028
1 vote
1 answer
3k views

Recreate MSDB for SQL Server Express 2008

My SQL Server Express database's msdb file has become 'suspect'. All the other mdf files seem to be OK. I now need to recreate the msdb file, but I do not have a backup for it (guilty as charged!). ...
user avatar
6 votes
2 answers
2k views

Is there a way to have SQL Server format a number into ordinal form?

Data 1, 2, 3, 4, 11, 21, 99 I want to get 1st, 2nd, 3rd, 11th, 21st, and 99th I could roll my own, but is there any function built into SQL server that could so this for me? Corollary: I will also ...
Daniel Williams's user avatar
4 votes
2 answers
3k views

Set permissions on a view

I'm creating a view on a SQL Server 2005 database via SQL Server Management Studio 2008, the view reads from two tables. The view is accessed from a web application and I want users to be able to ...
Ben Brocka's user avatar
  • 2,063
2 votes
1 answer
180 views

Is this Index checking logic ok?

I am writing a script to quickly check the indexes in a given database. I think I have the script written ok but to remove duplicate rows I have done alot of SUM functions and I am unsure whether this ...
Stuart Blackler's user avatar
3 votes
1 answer
6k views

Error restoring SQL differential database files

Occasionally I'm having problems restoring DB differentials. I'm getting the error "the differential backup cannot be restored because the database has not been restored to correct earlier state." ...
slowpoh's user avatar
  • 33
23 votes
8 answers
146k views

How do you kick users out of a SQL Server 2008 database?

We need to do a restore, and cannot because other users are connected. We thought we had disconnected every process, but apparently not. How can we, from Management Studio, kick off everyone else so ...
Daniel Williams's user avatar
1 vote
3 answers
5k views

Grouping results to get unique rows after multiple joins

this is my first question on dba.stackexchange, hopefully it will be worth it. I am usually a bit more active on Stackoverflow as I am a developer. disclaimer : I don't have full control over the db ...
Stephane's user avatar
  • 121
4 votes
2 answers
3k views

SQL Server 2008 R2 - Error 18456 State 12 - nothing I find helps me

First off let me state that I'm not a DBA, I don't have access to a DBA, I'm just a programmer who has to get a CMS working. I'm generally pretty good at getting random servers working, but this is ...
simon_marklar's user avatar
1 vote
1 answer
227 views

Migrating or Synchronizing SSAS Changes

Assume you have 2 SSAS databases, DB1 and DB2, that are identical. Now they branch off. Changes A and B are made to DB1 and changes C and D are made to DB2. Is there an easy method to migrate ...
Derek's user avatar
  • 1,631
2 votes
1 answer
3k views

Export data into word documents

My boss has a kindle and likes to save a lot of stuff to his clippings. Currently I'm going through and cutting out each clipping and pasting it into a seperate word document with the title of the ...
DForck42's user avatar
  • 3,028
103 votes
8 answers
21k views

Does SQL Server read all of a COALESCE function even if the first argument is not NULL?

I'm using a T-SQL COALESCE function where the first argument will not be null on about 95% of the times it is ran. If the first argument is NULL, the second argument is quite a lengthy process: ...
Curtis's user avatar
  • 1,255
3 votes
2 answers
6k views

Attach SQL Server 2008 R2 on SQL Server Express 2008

I have a database on SQL Server 2008 R2. I want to attach it on a SQL Server Express 2008 instance running on Windows 2003. I set the SQL server compatibility level on the database to SQL Server ...
Shahin's user avatar
  • 143
5 votes
3 answers
742 views

sql script repository [closed]

I am a fresh DBA just being promoted, I am looking for few good sites which constains T-sql Scripts for DBA tasks. Is there a common place from where you can get a collection scripts to perform ...
steve's user avatar
  • 119
3 votes
2 answers
470 views

Unable to BackUp Database on SQL2005

I have a database in MS SQL2005 that I can not backup. Whenever I try to create a backup of the selected database through SQL Mgm studio I get this error: The Backup of full-text catalog in not ...
adopilot's user avatar
  • 2,403
5 votes
1 answer
1k views

Why is 'Allow Snapshot Isolation' set to TRUE on the master and msdb databases?

Why is the database property Allow Snapshot Isolation set to TRUE on the master and msdb databases, but FALSE on other system databases? The default option for this property is also FALSE when ...
jrara's user avatar
  • 5,333
3 votes
2 answers
1k views

Recent Queries in SQL Server 2005

I'm using a PHP web application to interact with a database and need to catch an erroneous query. It's dynamically generated SQL and I don't know 100% of the code nor did I write it so I need to see ...
Ben Brocka's user avatar
  • 2,063
3 votes
1 answer
11k views

Using the name of a table contained in a column of another table?

I have a table called MyTable with varchar columns named SourceID and ReferenceID, where SourceID contains a table name and ReferenceID contains a key value for the source table. Is it possible in a ...
Jerry Gagnon's user avatar
2 votes
1 answer
112 views

Full Text Search in SQL 2008

When I attempt to search in the full-text catalog which is my created earlier, I haven't been finding any word within database. For example: My word: Where CONTAINSTABLE(TABLO,*,' "*Where*" ') ...
Cell-o's user avatar
  • 1,078
15 votes
3 answers
5k views

Testing stored procedure scalability

I have an email application that will be called upon to deliver to the UI the number of new messages for a given user on each page load. I have a few variations of things I am testing on the DB level ...
kacalapy's user avatar
  • 2,032
2 votes
1 answer
766 views

What system information is stored in the primary file in SQL Server?

Suppose I have created a new database in SQL Server with a file group FG1 and marked this as the default. All my user tables etc are now created in FG1. However I also created a file that is part of ...
Antonio2011a's user avatar
6 votes
5 answers
5k views

How much memory is needed to keep a table cached? (SQL Server 2008)

I run long and complex queries which mostly use one big table - 8GB, 40M rows. AFAIK, all/most rows are used in each query. I'm seeing lots of IO in the activity monitor - for the first query and for ...
ytoledano's user avatar
  • 223
14 votes
3 answers
14k views

Why is SSMS inserting new rows at the top of a table not the bottom?

Whenever I manually insert a row into a table in SQL Server Management Studio 2008 (the database is SQL Server 2005) my new row appears at the TOP of the list rather than the bottom. I'm using ...
Ben Brocka's user avatar
  • 2,063
1 vote
2 answers
346 views

Workload analysis before migration

Does anybody have a recommendation on which performance counters to collect and/or templates to use on the profiler before migrating SQL databases? The purpose is to evaluate the workload and make ...
db7's user avatar
  • 1,371
1 vote
1 answer
13k views

Set permissions on all objects for SQL users

I have a procedure that loops through all objects in the database and assigns them proper permissions to that object. I want to know if there is a better way to do this? I use a model database to ...
David Mathis's user avatar
1 vote
1 answer
749 views

Best Practice for Folder strucure?

I don't like my data files in C:\Program Files... , especially with a new system that has a smallish SSD as C: which holds mainly the operating system. So on a recent install I put my data files into ...
Daniel Williams's user avatar
1 vote
4 answers
339 views

Database backups

I have 10gb RDBMS (SQL Server). I would like to back it up as often as possible, but it seems that I will need an awful lot of space to make this happen on the order of several times per day. How ...
user avatar

1
661 662
663
664 665
674