Tagged Questions

Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).

learn more… | top users | synonyms (2)

8
votes
3answers
927 views

Fix for orphan user 'guest'?

What can be done, if anything, when the special guest user is orphaned (not linked to any login)? For one of my databases (SQL Server 2005), executing the following lists the guest user as an ...
0
votes
2answers
153 views

Want to create an SQL function that removes table row duplicates

I'd be following the procedure outlined here (unless of course someone has a better way to do it), and I'm wondering if I could just have some help being pointed in the right direction on how to ...
-1
votes
2answers
319 views

Tutorial in datamining [closed]

Where can I find about tutorial of datamining in SQL server 2012 or 2008 R2? The purpose is to improve my knowledge in datamining.
5
votes
1answer
696 views

Connecting to SQL Server using cached credentials

While migrating from SQL authentication (user-password) to integrated security I ran into an unexpected combination of requirements. SQL clients are services running under a LOCALSYSTEM or ...
10
votes
2answers
976 views

SQL Server Data Tools and partition functions

I'm creating a sliding window loading scenario and the partition functions will be changing their boundaries through time. I have created some partition functions in my SQL Server Data Tools (SSDT) ...
3
votes
1answer
349 views

tds: unable connect to SQL Server using servername specified in freetds.conf file

I am using freetds to connect to SQL Server from ubuntu. First, the SQL Server is running at port 1433 currently. I can telnet it. The following command also works. I can query table data using it, ...
4
votes
6answers
6k views

SQL Server log shrinking Issue [duplicate]

Possible Duplicate: Why Does the Transaction Log Keep Growing or Run Out of Space? I have a 300 GB database log in our SQL Server. I want to shrink all the logs but it is not allowing me to ...
1
vote
1answer
603 views

How many files should I create for one filegroup and 9 weekly partitions?

I have 9 weekly partitions on one filegroup. How many files do I need to create? There are 3 tables containing 46 million, 16 million and 10 million rows.
5
votes
1answer
213 views

Electricity off while shrinking database, how can I recover my database?

While i execute shrink database, the electricity has been gone down, I can't access my database now, it is (In Recovery), how can i recover it?? Note: it is a very huge database: 25 GB. EDIT: My ...
21
votes
4answers
2k views

Does the order of columns in a table's definition matter?

When defining a table, it's helpful to order the columns in logical groups and the groups themselves by purpose. The logical ordering of columns in a table conveys meaning to the developer and is an ...
13
votes
1answer
2k views

Why does SQL Server “Compute Scalar” when I SELECT a persisted computed column?

The three SELECT statements in this code USE [tempdb]; GO SET NOCOUNT ON; CREATE TABLE dbo.persist_test ( id INT NOT NULL , id5 AS (id * 5) , id5p AS (id ...
3
votes
1answer
455 views

Is it imperative that I backup my index files?

I have a few different instances (SQL 2000, 2005) with indexes placed in a separate filegroup. Do i need to ensure that this group is backed up, or will it be rebuilt by a restore of of the database?
0
votes
3answers
371 views

Custom SQL Server Computer Build

I hope this is the right place to ask this question. I'm a user at StackOverflow, and when I perused the StackExchange websites, this was the best match I could find. So, if I've posted in the wrong ...
4
votes
2answers
394 views

Can I do something like RESTORE DATABASE <server>.<databasename>?

Is it possible to restore a database on a server, using a script on another server? For example, I have a server A and a server B and I want to restore a database foo on server B from within a script ...
3
votes
2answers
120 views

Creating SQL Servers on VMWare

Can you recommend a good self service solution for creating SQL Databases? Our dev and test teams need to frequently create new databases. I would like to keep these databases as close to production ...
3
votes
5answers
3k views

How to get the total days per month between two dates?

Given two dates like 20120302 and 20120605 I need to get a list of Months and the total days in those months that fall between those two dates, like so: March 28 April 30 May 31 June 03
8
votes
1answer
297 views

Defragmenting SQL Server data and log files live with MoveFile API

My employer is looking at deploying NTFS defragmentation software that uses the Windows MoveFile API to defragment open files. This would get deployed to thousands of SQL Server servers running SQL ...
1
vote
2answers
298 views

Explicitly update a table after sp_tableoption “text in row” advices wanted

I have an extremely slow sql server 2000 DB with 8GB, and the cause of this is the 3 ntext columns which are in the more queried table. Table has indexes set and also the full-text ssearch index set ...
11
votes
2answers
13k views

What is the purpose of the database 'owner'?

Today while troubleshooting a service broker problem, I discovered that the database owner was the Windows login of an employee who had left the company. His login had been removed and thus the query ...
13
votes
3answers
3k views

Should I migrate data using detach/copy/attach or through backup-restore-replay?

I am about to embark on migrating database files to a new SAN (from an old SAN) abd I have a couple of options to implement this. (1) It was suggested that I look into the level of effort of restoring ...
4
votes
3answers
1k views

SQL Server stored procedure keeps restoring to previous one

There's a Stored Procedure in my database which keeps restoring to the old one, I Alter the stored procedure using Management Studio, however some time later, unexpectedly, the stored procedure ...
8
votes
10answers
7k views

Sql Server Management Studio slow opening new windows

After upgrading both sql server and management studio from 2008 to 2012, the management studio 2012 is very slow when new query windows and dialog boxes are opened. Even right click on tables is slow. ...
3
votes
1answer
1k views

Executing the query “UPDATE STATISTICS [dbo].[Contact] WITH FULLSCAN …” failed

My maintenance plan fails with the following error on one of my databases does anyone know how I can fix this problem? is is a corrupt table? Executing the query UPDATE STATISTICS [dbo].[Contact] ...
1
vote
1answer
307 views

Is there a way to make the subscriber database read-only when using Transaction Replication?

I have set up Transaction Replication and its working well. I have a few different web apps that connect to the publisher and subscriber database and I am concerned that if they use the subscriber ...
6
votes
1answer
1k views

How to get online the database which has missing/corrupted FILESTREAM files?

I've corrupted the files related to FILESTREAM in a database. The .mdf and .ldf files are still intact, but when I try to get the database online, it complains, saying that the files related to ...
1
vote
0answers
141 views

How do I use MDX scripting in SQL server 2005 Business Intelligence Development Studio to create the following Member? [closed]

I am using Microsoft SQL server 2005 Business Intelligence Development Studio to build a cube. I need to calculate a member called INCREMENTAL OVERTIME. INCREMENTAL OVERTIME is based off of the ...
2
votes
1answer
241 views

Is it possible to make a reference to the result of an aggregate function in a SELECT clause from the same SELECT clause?

I'm not a Database Administrator--just a Software Engineer. I would like to know if it is possible to reduce the following T-SQL query: SELECT SUM(Price * Quantity) as 'Total', SUM(Price * ...
8
votes
4answers
2k views

Best way to store units in database

I have inherited a large (SQLServer) database with hundreds of columns that represent amounts of one thing or another. The units for these values (e.g. "gallons", "inches", etc) are stored in the ...
2
votes
1answer
3k views

SQL Server Rebuild/Reorganize Fragmented Indexes causes CRC error or consistency errors

In our test lab I've been experimenting with different jobs to keep our critical indexes from becoming too fragmented. I'm currently using the approach described here: sys.dm_db_index_physical_stats ...
0
votes
2answers
556 views

Creating a test database from Production database (different machines & servers)

I'd like to set up a test database on a separate server. Production database is MS SQL Server and the test server is a *nix box so I'd like to have the test server running either PostgreSQL or MySQL. ...
9
votes
2answers
7k views

Performance difference between Clustered and Non Clustered Index

I was reading Clustered and Non Clustered Indexes. Clustered Index - It contains Data Pages. That means the complete row information will be present in the Clustered Index Column. Non Clustered ...
0
votes
1answer
1k views

how do I merge two views

I have basically two views named customerV and productV. the SQL statement in the customerV view is : SELECT CUSTOMER_REGISTRATION.SURNAME, CUSTOMER_REGISTRATION.OTHER_NAME, ...
4
votes
1answer
4k views

Why does sqlcmd -Lc not show the local instance?

I have two machines, each with a default instance of SQL Server 2008 installed; each exhibiting a different behavior. On PC1, when I run sqlcmd -Lc, I do not see PC1 in the list of SQL servers on ...
11
votes
1answer
12k views

Varchar(Max) field cutting off data after 8000 characters SQL Server 2008

I have a field to store some data, the field is declared as varchar(Max). To my understanding this should be storing 2^31 - 1 characters but when I enter some content over 8000 chars it cuts the rest ...
2
votes
3answers
5k views

Microsoft SQL Server says my login is disabled, even in single user/DAC mode

I'm locked out of a local database, and the single-user mode option that has worked for me in the past isn't working for me here. I could use some options to try. It's saying the account is disabled, ...
2
votes
1answer
424 views

use variable table in OLE DB source

I try to export data to a flat file from OLE DB source. Here is what I do under OLE DB source editor. In SQL command Text: declare @t table (customerid varchar(100),[enrollment_Date] ...
2
votes
0answers
275 views

going from heirarchical XML to heirarchical SQL tables then SQL to c# objects to go to user view, how should I store the data in the databases?

Hi I'm getting my data from a web service using their getData call and it comes in as fairly chunky heirarchical XML, first everything all at once, like <allData> <product1> ...
7
votes
3answers
6k views

View delete statements in the Transaction log

Is it possible to view delete statements that have recently occurred in the Transaction Log?
4
votes
1answer
666 views

Does SQL Server evaluate functions once for every row?

I have a query like this: SELECT col1 FROM MyTable WHERE DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) BETWEEN col2 AND col3 ; This gives a tooltip on the execution plan ...
6
votes
1answer
4k views

Why does SQL Browser service get disabled?

I have an intermittent problem with a software installation package that installs our product (written using InstallShield/InstallScript). During the process of the installation, we restart the SQL ...
3
votes
2answers
275 views

Reduce load off primary server by using log shipping, or mirroring, or something else?

I have previously asked the below question about LogShipping frequencies, but I think I might be approaching this problem incorrectly (LogShipping frequency) Problem I have a high volume site that I ...
4
votes
2answers
435 views

Using surrogate key after merging the person's data?

This question is about business intelligence with sql server 2008 R2. If you have a person named Jim Brown with his birthdate and social security number (SSN) being located in three different source ...
2
votes
1answer
2k views

Configure second SQL Server Alias for named instance

In my devopment environment (Win 2008 server) are running two sql server 2008 instances (default and named instance). Already one Sql alias is configured and pointing to the default instance. I want ...
5
votes
1answer
293 views

SQL Server SMO Method “Discover()”

I think I just found the coolest thing every with SQL Server SMO and PowerShell. I was asked to get a script together to find the owner of every object in an instance of SQL Server. I found a script ...
2
votes
2answers
483 views

LogShipping frequency for backup/copy/restore

I wish to create a LogShipping job that runs every 5 minutes. What is the best way to do this so that the backup/copy/restore does not collide? Maybe Sql server knows how to handle this, but I was ...
8
votes
2answers
6k views

Why index REBUILD does not reduce index fragmentatation?

I have used ALTER INDEX REBUILD to remove index fragmentation. In some cases REBUILD does not seem to remove this fragmentation. What are the reasons why REBUILD does not remove fragmentation? It ...
6
votes
1answer
427 views

Is there a way to DENY CRUD operations on connections from linked server?

I have a SQL Server instance, RPT1 (2008 R2), that was set up for "power users" to run their own queries. This server is linked to our production reporting server, PRD1 (SQL Server 2008 instance), ...
4
votes
2answers
179 views

Does a dual key or single key lookup perform better on a table with a lot of data?

We have table where rows unique between 3 columns. GroupA, GroupB, ProductID. GroupA & GroupB are used in combinations to Group sets of ProductIDs and will always be used to lookup sets of ...
2
votes
2answers
2k views

Network-related or instance-specific error

I have a problem when I run my web project. I get this error : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was ...
5
votes
2answers
947 views

What permission is needed to set Database read-only?

I am dbowner of a database which I want to set read-only. (through sql management studio). When I try that I get a permission error (297) Which role is needed to perform that action?