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

learn more… | top users | synonyms (2)

1
vote
1answer
47 views

SQL Server specific file group

I have a database with three file groups, Primary, FG_ExtendedTables, and FG_ReportingTables. I need to create another database (production db let's say), and restore only specific file groups and ...
9
votes
5answers
1k views

How to hide/disable tables without dropping them to check redundancy?

I have to maintain and extend an old legacy system which contains webservice methods and database tables that are no longer used. Since I’m not entirely sure that the tables are really redundant, I’m ...
6
votes
3answers
130 views

Does alter column change datatype use tempdb version store?

I was running alter column from INT to BIGINT, my table size is 250 GB and after 1 hour I got the version store error because tempdb was full. As far as I know it only takes your memory pages and log ...
0
votes
1answer
26 views

MS SQL server issue - 'PRIMARY' filegroup is full

I got below error whenever my application tries to update/insert any data to database. Could not allocate space for object 'myDB' in database 'I 3 Stroke' because the 'PRIMARY' filegroup is full. ...
0
votes
0answers
15 views

Optimal Number of Queries Per Batch for SQL Server

I am optimizing an application for a scenario where it will import an sql file and execute over 11 million create commands, which have have some expensive subqueries that are outside my control. This ...
0
votes
2answers
33 views

How to restore backup and keep exisiting data in MSSQL? [closed]

I have test database and test table with some values, for example my table have name and family tables and john,doe as values. I want to restore my old backup to test table,database and keep my ...
0
votes
0answers
20 views

Example Database for tunning

I've been searching for so long and I've still have not found what I'm looking for ,is there any database or similar resource that people uses for tuning a database, or optimize queries?. I would be ...
3
votes
2answers
45 views

Fill in missing dates with data value from previous populated date for group

Picture help desk tickets that gets transfered between departments. We want to know what the department is at the end of the day for each ticket for each day that the ticket is open. The table ...
-1
votes
1answer
100 views

Comma Separated values in sql server [on hold]

I have three tables with relationship. TableDetail ID(PK), TableNo BookingDet ID(PK), BookID(FK BookingMstr.BookID), TblID(FK TableDetail.ID) BookingMstr BookID(PK), Date I want to get table ...
0
votes
0answers
20 views

Cannot drop schema sql server

I'm trying to delete a schema but I am with the following message: Lock request time out period exceeded. (Microsoft SQL Server, Erro: 1222) Does anyone know how I can fix?
3
votes
1answer
59 views

Delete User View named the same as system view

I am exporting a database to Azure and have found a user view created in a previous version of MSSQL (Currently running 2008) that is name INFORMATION_SCHEMA.TABLE_CONSTRAINTS which obviously should ...
0
votes
1answer
42 views

Open .mdf and .ldf files in Microsoft SQL Server without attach [closed]

I want to open .mdf and .ldf files in Microsoft SQL Server without attach. Are the following steps correct? Add new database with MYDBNAME name. Copy the files MYDBNAME.mdf / MYDBNAME_log.ldf to ...
1
vote
1answer
35 views

SQL Server - Create Additional Database File for New Schema

I'm trying to create a change script for some upcoming changes. We're adding a new schema to the database and our client wants the new schema to make use of a new database file. How do I, in T-SQL, ...
0
votes
0answers
25 views

How to audit user that reinitialized replication in sql server

How can we track who reinitialized our replication. Is there a way to check this user or login? Thanks in advance
1
vote
1answer
64 views

Repair with data loss did not fix index corruption. What now?

A few months ago we migrated our SQL Server 2014 database to a virtual environment. Soon afterwards, corruption started showing up in indexes, causing all sorts of trouble. I've made repairs using ...
0
votes
0answers
72 views

SQL query too slow to fetch single row of data

we have this SP, running extremely slow to fetch a single row of data from tables within 100K rows, which seems not that big. It takes onn avg 15-20 mins to complete. We have tried to remove all ...
1
vote
2answers
61 views

Get the Text of the currently running SQL?

This is something I am just interested in knowing if it is possible. Could I write an SQL query that could return the text of itself as a variable? Where I might use this would be on things like ...
3
votes
1answer
45 views

Wrong estimated number of rows using TOP condition

I guess this is a very basic question but I can't get my head around it.. I have perfect statistics in place for a column but while using a TOP condition the estimated number of rows are always a ...
0
votes
0answers
25 views

Secondary database log file in alwayson is very big [duplicate]

I have an alwayson environment (AlwaysOn AG). Database [UsersDb] in the slave server, His log file is very big . How can I reduce his size(shrink)?
3
votes
1answer
42 views

Converting SQL SERVER Procedure to POSTGRESQL

I have procedure in SQL Server to print all players of given country. I try to convert it into plpgsql, but I get errors. SQL Server Procedure CREATE PROCEDURE kraj_pilkarze @kraj varchar(30) AS ...
3
votes
0answers
55 views

Why would Stolen Memory counter be at a constant high? [duplicate]

I'm trying to understand memory stats a lot better and have been troubleshooting an issue with one of our SharePoint DB servers for a while now. Low PLE, frequent lazy writes, slow performance etc I ...
1
vote
0answers
28 views

Resolve “stuck” system process of dropping indexes

I am re-vamping some indexes, and have decided to drop 3 on a certain table. The process has been running for almost 2 hours now. The table does have quite a few million rows, but I still feel that is ...
11
votes
2answers
294 views

How to write a query in SQL Server to find nearest values

Let's say that I have the following integer values in a table 32 11 15 123 55 54 23 43 44 44 56 23 OK, the list can go on; it doesn't matter. Now I want to query this table and I want to return a ...
0
votes
2answers
35 views

Prevent duplicate record counts in one to many query

I'm trying to get a count of ethnicity for a teachers students. My first table contains the student number and ethnicity. The second table contains teacher id's, student numbers, course numbers, and ...
0
votes
1answer
44 views

SQL Continuous Table Updating: Best Practices?

I have a highly "vertical" database, and I've written a dynamic pivot script to build a new time-indexed table that I can actually query on human time scales. Pivoting the table takes a few minutes ...
0
votes
0answers
41 views

automate import and export of process EXCEL -> SQL SERVER - > EXCEL without using SSIS

I have an ETL process that is entirely written using T-SQL scripts. The script grabs an Excel spreadsheet and imports it using openrowset. Once I get the transformed data I copy with headers and paste ...
0
votes
0answers
56 views

SQL Server 2014 client installation [closed]

We are upgrading from SQL Server 2005 to 2014. I am trying to install tools on my client machine to connect to the new test server. I downloaded SSMS Express and installed the management tools and ...
4
votes
1answer
159 views

Will a nonclustered index with a unique column always address all queries filtering that column first?

I have found large heap tables that are over-indexed and for example have multiple different nonclustered indexes with different columns, but some of those indexes have the (only one present) primary ...
1
vote
1answer
39 views

Help with maintenance strategy

I have a rather atypical database situation, so am finding researching it a bit difficult. The question first: what kind of maintenance strategy do I need to put in place? The setup: The whole ...
-1
votes
1answer
53 views

-2147483648 value in integer type column despite entry mask [closed]

I have a desktop application with a textbox field that is a RadMaskedNumericInput with #6 masked value, meaning it can only have 6 digits. I store it in a database column of int type. When I examine ...
1
vote
2answers
23 views

SQL Server Cluster + Availability Groups?

I'm actually finding a way to provide a good High Availability and Failover solution while I have a way to manage some sort of horizontal scalability and Load-Balancing... I actually have a SQLServer ...
0
votes
0answers
34 views

SSIS - The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION

I am trying to use explisit transactions within SSIS. The database I am working with does not have the DTC enabled, so I cannot use SSIS' inbuilt transaction handling. I have execute sql tasks to ...
3
votes
0answers
48 views

Find SQL Server edition and version from setup files without installing [duplicate]

I want to know how to find SQL Server edition and version details from SQL Server setup without installing it. I have been in situations where sysadmins put SQL Server setup files on a file server ...
3
votes
1answer
33 views

Do signed certificates from public certificate authorities add any value for always encrypted?

If I create Always Encrypted columns in Microsoft SQL Server from the SSMS gui, it makes a self signed certificate. Is there any value in making a CSR and paying a certificate authority (or using ...
1
vote
2answers
39 views

User cannot select from table but their permission appear to show that they should be able to

I attempted to revoke delete permissions to most users in a database by using the deny and revoke sql commands and checking the deny box for delete when adding the table as a securable in the UI. ...
-1
votes
0answers
32 views

SQL Server Aggregate Function: “Get First Available”?

Does anyone know of a "get first available" aggregate function for SQL Server 2014? I would like to use such a function on a dynamic pivot table to speed up performance. The situation is that I only ...
3
votes
1answer
19 views

Error When Trying to Run MDW Data Collector

I have SQL Server Management Data Warehouse (MDW) set up across multiple instances, all in the same way with the same accounts and permissions. On one server I get an error when trying to run the ...
1
vote
1answer
38 views

are overlapping multi column statistics redundant?

I have run a database engine tuning advisor session, DTA, to optimize my database. The DTA has produced some statistics recommendations, however, I noticed some are contained in others for example ...
3
votes
2answers
60 views

Why am I getting this ANSI warning about NULL values and aggregate functions?

This is the exact warning message: Warning: Null value is eliminated by an aggregate or other SET operation. I understand what it means in general, i.e. that there's a null value in one or more ...
0
votes
1answer
14 views

Combine addresses missing Unit/Suite #

I have a list of addresses which need to be updated in SQL Server. How can I go about adding the Suite # to the addresses which are missing it? Address 1 Burton Hills Blvd, Suite 250 1 Burton Hills ...
0
votes
0answers
18 views

Move large text field to filestream without having to rewrite all codes MSSQL

My MS SQL Express Database keeps hitting the 10G limit. In a few months, we will migrate to Azure DB. In the mean time, to avoid problems, I'm thinking moving a huge text field (storing long html ...
3
votes
3answers
191 views

9 digit zip codes are reporting LEN of 12

I am attempting to resolve some difficulties in getting zip codes to display properly. The original spreadsheet has zip codes of mixed 5 and 9 digit formats. After the import process, these 9 digit ...
5
votes
2answers
67 views

Stable triangle relationship?

I have a table that represents a specific type of action. Let's call it [ACTION]. An action can be performed by a user ([USER]), so I have the relation [USER] 1:N [ACTION]. The user can have ...
4
votes
1answer
40 views

How to check for Non-Ascii Characters

What is the best way to check if a VARCHAR field has Non-Ascii Characters? CHAR(1) through CHAR(31) and CHAR(127) through CHAR(255). I tried using PATINDEX and have run into the following issue. ...
7
votes
1answer
234 views

Is there a way to see how SQL Server 2012 defines new identities?

On Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64), is there a way to see what mechanism SQL Server uses to calculate the new identity values for tables created by SELECT INTO? SAMPLE DATA -- ...
1
vote
0answers
30 views

Buffer pool extensions disabled for no apparent reason

I've tested Buffer Pool Extensions on an Amazon EC2 virtual machine. The VM has a single non-persistent high-performance SSD. On VM shutdown the SSD contents are lost, so it can't be used to store ...
2
votes
3answers
214 views

Monitor database every hour to prevent data loss

Here is my requirement, though I'm aware what could possibly be done to fulfill it but still looking out for the best solution to work out with. Few days ago someone(some hacker or some previous ...
1
vote
2answers
38 views

Does the EXIST clause only return distinct rows by its nature?

I have two queries that appear to be logically equivalent, yet they return different result sets. I am using the AdventureWorks2012 database. The first query uses an EXISTS clause with a sub query. ...
2
votes
2answers
50 views

Migrate SQL Server backup to MySQL for a Wordpress site

I have a client with an old .Net site that used SQL Server. For lots of reasons they decided to switch to Wordpress. They had a bunch of news articles on that old site that they want turned into posts ...
1
vote
2answers
46 views

How to find the size, name and other details of Analysis server database?

How to find the size, name and other details of an Analysis Services database ? I have a Analysis Services server and I can see one database inside that. I want to know the size and other basic ...