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)

0
votes
1answer
45 views

DB Permission: User can drop only their created db's?

I want to set permission against a user, which can create database and drop on their created databases neither any database. Any idea/suggestion ?
0
votes
2answers
79 views

How can I replace the following query with ISNULL function in SQL?

I have the following query. For performance optimization reasons I have been asked to replace the logic with ISNULL function in SQL. How can I achieve this? please advice. SELECT ...
0
votes
1answer
64 views

Enhanced ER Model Supertype / Subtype modeling issue with inheritance and recursion

Before posting, I have looked for a good solution on internet and I have coined this post for 3 days in row and trying to think through it prior this post. So if I have missed something or got it ...
0
votes
0answers
52 views

How can I replace the cursor in the below query?

I have this below query which calls a stored procedure that takes only 1 item's attributes at a time. But because of performance problems we are required to remove the cursor. How can I replace the ...
1
vote
1answer
32 views

In SQLCMD is there any way of shelling out to run arbitrary programs?

In the past I have dropped json into a table in a nvarchar(Max) column. This is structured data but it needed serving back to the client as json and came in from the client as json so it seemed a bit ...
0
votes
1answer
43 views

SQL Server 2008 R2 service packs

Are the SQL Server service packs 'cumulative' or 'incremental'? The scenario is that we have a couple of instances running on SQL Server 2008 R2 RTM and we have been asked to patch it up to SP3 ...
0
votes
1answer
32 views

SQL Server : how can I measure database performance increase after index maintenance?

We are using a SQL Server 2005 database. We currently have no maintenance on our databases indexes. Some of our indexes are showing over 85% fragmentation when looking at the table ...
1
vote
1answer
57 views

SQL Server Mirroring can't connect to mirror database

I am at my wits end with this. I am trying to set up mirroring between a development server and my local machine. The error that keeps coming up is: Msg 1418, Level 16, State 1, Line 1 The ...
1
vote
1answer
46 views

Why is my transaction file growing when db is in simple mode and there are no waiting transactions

I noticed that my database log file has reached 160GBs. My database is in simple recovery mode and I used the following query to see if there are any waiting transactions. SELECT ...
0
votes
1answer
45 views

Multi Tenant Identity

Is there any way to declare identity partitioned by tenant id? For example I want to have this structure: tenant_id | record_id (auto increment) --------------------- 1 | 1 1 | 2 ...
2
votes
1answer
44 views

Set based query to group data ordered data

I have a table of user action data and I would like to try and group it into 'sessions', so I could figure out how many times a user has logged on, how long they stay online, and how many actions they ...
0
votes
1answer
58 views

SQL Server table and view show different values

I have a view that selects data from a table that is showing different data. The table is dbo.user, the view is dbo.users (don't judge, I inherited this system). The view is simply select * from ...
0
votes
0answers
27 views

Optimal index wasn't being used until rebuilt

SELECT COUNT(T1.RECID) FROM LEDGERJOURNALTRANS T1 WHERE PARTITION=5637144576 AND DATAAREAID='abcd' AND JOURNALNUM='abcd-00018' This query gets run numerous times when users view a ...
2
votes
1answer
32 views

SQL Server Restore w/o “Closing Existing Connections”

By default in SSMS (2012/2014) when you choose to restore a database, the "close existing connections" option located in the is by default unchecked, is it possible to restore a database while ...
0
votes
1answer
22 views

Concatenate two functions in a result

I'm trying to add this as one of my columns: REPLACE(REPLACE(REPLACE(dbo.new_truck.new_Description| CHAR(13)| '<br>')| CHAR(10)| '<br>')| '"'| 'in')+'Location: ...
3
votes
1answer
70 views

How can I monitor my server’s status before changing the “Cost threshold for parallelism” settings

Our production server is running SQL Server 2008 SP3. I’ve read a post on “cost threshold for parallelism” - ...
0
votes
2answers
57 views

SQL storage sizing - How to get statistics of what data is being accessed

How can I monitor which data is being accessed and which frequency? I'm in need to migrate several (very) small SQL Server instances, each which several small databases. Current configuration is ...
0
votes
0answers
13 views

TDS version 5 - Characters format

Someone knows what characters format type supported in TDS 5? All I found is about TDS 7 and above.
0
votes
0answers
35 views

Indexing on cached data from related table using triggers — Is there a better way?

Edit: Schema details per request from Aaron Betrand -- I'll break the schema down to the relevant fields of the two tables. Orders (ID int IDENTITY, Status char(1)) Services(OrderID FOREIGN KEY ...
1
vote
2answers
22 views

Will adding features pick up previously installed service pack updates?

We have SQL Server 2008 R2 SP3 installed. Need to add a feature to the installation, Business Intelligence Development Studio. The question is do features installed after the application of a service ...
-1
votes
0answers
36 views

How can I catch in logs SQL server failover switched to other node

Hi I want to be notified if SQL Server makes a failover and switches active nodes either if someone switched it or there is a real problem. Our monitoring tool can read windows event logs but I don't ...
0
votes
0answers
52 views

Query Performance - Why is a query slower when there are two criteria on the same column?

I have these two queries against a view, where I've added WHERE clauses against a date column (Indexed, Unique, Non-Clustered, Ascending): SELECT ColA FROM MyView a WHERE a.[Date] >= ...
1
vote
1answer
70 views

Copying SQL Server database

I am working on a SQL Server on which I have three databases: User: This is the one where real data resides Test Development: This is used for testing and developement. From time to time I want ...
1
vote
2answers
56 views

Switch from full to simple recovery

This is a theoretical question to help my understanding. What is the process to switch from full to simple recovery model in sql server? Is the process as follows: Take a trans log backup before ...
-1
votes
1answer
44 views

Restoring a backup of a database from SQL Server 2014 into SQL Server 2012 [duplicate]

Is it possible to load a backup of SQL server 2014db into SQL server 2012? Trying to import/restore is throwing backward compatibility issues. Thanks
5
votes
2answers
97 views

How to move a fairly large tsql table from one server to another server?

I have been working on thinking of ways to move a 40gb table from one SQL Server box to another SQL Server box. They are at separate companies without an intranet linkage and obviously without linked ...
2
votes
1answer
26 views

Grant Windows logins to read a secondary database of log shipping?

The following link, Creating Users on secondary server in log shipping, shows how to create a database login on the secondary server. How to grant Windows logins on the secondary server to access the ...
0
votes
1answer
18 views

SQL User Permissions for Continuous Integration via TeamCity

We are building a TeamCity project, which would be getting some scripts from the SVN location and deploy against the production database server. This scripts will be generated by our developers, which ...
0
votes
0answers
46 views

Rounding Casted Converting Error

The database I am working with has ntext datatypes which according to my understanding is evil. I used CAST to varchar to fix the issues in the below trimmed SQL Server query. Anyway, my question is ...
0
votes
1answer
23 views

Differential Backup since a date

Hi is it possible to do a differential backup in ssms 2014, so that it gets all changes since a specified date?
0
votes
5answers
47 views

Getting Data Back after Wrong Data Restore in SQL Server

I would like to inquire if there is an possible way to return lost data that stored in a Sql server Database after making a wrong database restore? I know it is extremely hard to get a positive ...
1
vote
1answer
57 views

Hyper-V Dynamic Memory and SQL Server

I will probably get voted down for this, but does anyone have a good place to start other than the Best Practices Documentation for using Dynamic memory with SQL server. We are experiencing issues ...
1
vote
0answers
24 views

Can we configure Certificate-based Authentication to connect(logon) sql client?

Can we configure Certificate-based Authentication to connect(logon) sql client? or any other method to connect sql client using mutual authentication(sql server and sql client)?
0
votes
2answers
51 views

Find tables with modified data after a specified datetime [duplicate]

I am performing few inserts and updates on my database using tool provided by app supplier. I want to compare the updated database and backup after running the tool. But my database size is around ...
2
votes
3answers
300 views

Why is the SQL Server query plan not using indexes in a query almost similar to one that uses indexes?

I have two UPDATE queries that are similar in structure, yet the SQL Server query plan for one shows indexes being used, and for the other it shows only a regular table scan. The following are the ...
0
votes
3answers
72 views

Script to merge-replicate two MDF database files?

I have a program on a computer and on a tablet. The program uses SQL Server Express to interact with a local database (the same information on both) from a .MDF file. So if I plug the tablet into the ...
1
vote
0answers
24 views

Alwayson Database Recovery Failure during TDE encryption

Last week I enabled TDE encryption on my AlwaysOn Availability Group databases of SQL Server 2012. During the encryption of one of the larger databases, bigDB (~200gb) a failover event occurred. Of ...
7
votes
2answers
199 views

SQL Server - Changing a column from NOT NULL to NULL - What's going on under the hood?

We have a table with 2.3B rows in it. We'd like to change a column from NOT NULL to NULL. The column is contained in one index (not the clustered or PK index). The data type isn't changing (it's an ...
6
votes
0answers
136 views

Crashing CLR on SQL Server 2014 (windows 2012R2)

I have this small CLR that does a RegEX function on a string in columns. When running on SQL Server 2014 (12.0.2000) on Windows Server 2012R2 the process crashes with Msg 0, Level 11, State 0, ...
1
vote
3answers
96 views

How to restore mdf file in sql server 2005?

I have a .MDF file and no .LDF files for a database created in SQL Server 2005. When I try to attach the .MDF file to a different SQL Server, I get the following error message. I would like to ...
0
votes
2answers
28 views

Sudden Slow Reports [closed]

we have reports on our report server that are running slow all of a sudden. They were working fine and then all of a sudden over the weekend they started to process incredibly slow. It appears that ...
0
votes
0answers
16 views

Adding an Article to an existing Merge Replication Publication only worked for some subscribers

I added 2 tables to an existing Merge replication Publication and then ran a new snapshot. After it was all said and done the publication pushed the tables to some of the subscribers when they ...
0
votes
1answer
59 views

SQL Server : execute stored procedure from another stored procedure

I have two stored procedures. Proc1 executes a SQL statement and results a data table as a result set. I need to use the datatable in a select SQL that resides in proc2 as a datasource. like, ...
0
votes
1answer
39 views

Operating system disaster recovery strategies

I have read a lot about disaster recovery planning of databases (mainly SQL Server). There are multiple articles/book chapters about backing up databases and recovering them from backup. But what if ...
1
vote
1answer
95 views

How to get the return value from a stored procedure executed with sp_executesql

I need to call a stored procedure in another database and check the return value. The name of the other database can vary so I'm trying to use sp_executesql, but I haven't been able to find how to get ...
0
votes
1answer
38 views

Clustered Index Update

I am trying to understand why is my query (update statement) causing clustered index update in the plan? Based on my clustered index (in the where clause), I am just updating columns in my table. What ...
3
votes
0answers
65 views

What exactly can SQL Server 2014 execute in batch mode?

When a columnstore index is being used in a query SQL Server is able to use batch mode. Documentation is thin on what can run in batch mode and what can't. Please look at the following (motivating) ...
0
votes
0answers
33 views

How can I record previous data when they are updated in a table?

I would like to record all previous addresses and postcodes in my "Audit" table when they are updated in the "Customer" table. I'd like to record a primary key column, user, date of update, customer ...
1
vote
0answers
31 views

DBCC SHRINKFILE (N'XYZ' , EMPTYFILE) using single core

Is there any way to force DBCC SHRINKFILE to use more than one core? We're running SQL Server 2014 on a hex core machine - and SHRINKFILE is using one hyper threaded core. I/O is at a small fraction ...
1
vote
1answer
17 views

Groups relationships - Detailed or Direct?

I have a Person model: PersonId Name ----------- ---------------- 1 Jessica 2 Jennifer Then I have a ShareModel which have the Personand an ...