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
0answers
9 views

Sql Dependency with Service broker working fine when sql server presents local system but its not working when database is at remote system [on hold]

I have an application which uses sql service broker and sql dependency in c# application. Its working fine when my database is at the local machine but it does nothing when the database is at remote ...
2
votes
0answers
20 views

Remote access to SQL Server 2008 R2 on Windows Server 2012 R2?

I have SQL Server 2008 R2 (named instance) on a Windows Server 2012 R2: Enabled remote access to SQL Server Enabled shared memory & TCP/IP protocols & named pipes for the SQL Server ...
5
votes
1answer
81 views

Azure: Many Failed Login Attempts Logged

I run a SQL Server on an Azure Virtual Machine. I have noticed in the Event Logs of the server lots of failed SQL Login attempts using a ton of different usernames (none of which exist): Login ...
0
votes
0answers
25 views

Sharing a database over the local network [migrated]

We have some plate nesting software at work which I use daily. Recently, I thought I'd try to get the shared database up and working so the boys in the workshop could use the software on another PC ...
-4
votes
0answers
19 views

sql server stored procedure clockin [on hold]

how to create a stored procedure with clockin,clockout columns and I want to show the time worked from them and the min_leave_time when user clockin and out for breaks on a 8 hr. shift with lunch only ...
2
votes
3answers
49 views

Return even empty groups when grouping by date

I have the following query: SELECT DISTINCT COUNT(CD_BarCode) ,CD_Carrier ,SUBSTRING(CONVERT(VARCHAR,DT_Arriving,103),1,11) Date FROM TB_AGIL WHERE ...
4
votes
2answers
256 views

Tell SQL Server a query is ad hoc and not to optimize based on it

Is there a way to run a one-off query against a production SQL Server database and tell it not to make any future judgments based on that query. E.g. Store execution plans, recommend indexes, etc. ...
2
votes
2answers
51 views

Add a flag when certain conditions are met

I have a table where when an employee works LEAVE1 and LEAVE2 paycodes on the same day then in the new column called 'FLAG' we need to put a 1 for LEAVE1 and a 2 for LEAVE2, when these paycodes are ...
2
votes
1answer
22 views

Availability Group environment clone

I've been assigned a project where we have an active secondary environment that I'm confident that Availability Groups would address but have some questions that I hope someone can answer for me. ...
0
votes
2answers
45 views

How to create Date table

I have problems when I try to create my DimDate. That's what I have tried: CREATE TABLE [dbo].[DimDate] ( /*[ID] [int] IDENTITY(1,1) NOT NULL--Use this line if you just want an ...
1
vote
0answers
25 views

Transactional replication taking hours to replicate

I have a bunch of tables replicated from my_publisher to my_subscriber via my_distributor. Some of these tables, not all of them, when updated on my_publisher, take a couple of hours to be updated on ...
4
votes
1answer
162 views

Running a sql server query with as little impact as possible

I'm looking to create some basic scripts that are aimed at running on production systems. I want them to run with as little impact as possible. They shouldn't affect performance whenever possible, ...
2
votes
1answer
30 views

Finding out what permissions are required by the SQL Server Agent Jobs

I've been looking at this for a while and I can't work out an easy way to do this. As it stands every job in the database runs under SA level rights (horrifying thought) I'm sure some of the jobs ...
3
votes
1answer
176 views

Gigantic gaps in IDENTITY column

This question is about strange behavior in SQL Server 2008 R2 SP3 Standard Edition x64. I have read many questions about IDENTITY increments in SQL Server and strange gaps between them. But basically ...
2
votes
1answer
34 views

Meaning of SERVERPROPERTY ('ResourceLastUpdateDateTime')

I have researched a while, a lot of articles name it and tell us to use it - but none really explains the meaning of the date and WHEN exactly it changes. Does anyone know? Samples for articles not ...
3
votes
1answer
25 views

Wide clustered index vs multiple narrow nonclustered indexes?

Say I have a contrived Student table like so: CREATE TABLE Student ( Id IDENTITY INT, SchoolId INT NOT NULL, FirstName VARCHAR(20) NOT NULL, LastName VARCHAR(20) NOT NULL ) ...
-1
votes
3answers
23 views

Selecting multiple rows as one row with “AS” [on hold]

If I have a table of users, for example, and I want to include the users in a query like so: SELECT gameId, player1id, player2id, users.username as player1, users.username as player2 FROM players, ...
0
votes
0answers
33 views

SQL SERVER 2014 windows administrator locked and sa password lost [duplicate]

I am missing the sa password for a SQL Server 2014 instance. Unfortunately the Windows Administrator user is also locked. How can I reset my sa password?
1
vote
0answers
56 views

Routing data from one SqlServer to another

Is there a way in SqlServer 2012 to have data being written to one table routed to another SqlServer on another host ? To clarify, we are using Hibernate Envars to write audit logs. Hibernate Envars ...
2
votes
1answer
62 views

Scramble the data output of a stored procedure

I have a stored procedure that produces data for a call center system every morning. However, the data is sent in the same order daily. Is there a way to send the day in a different order every day ...
0
votes
0answers
22 views

How to install SQL Server Agent in existing SSMS [on hold]

I have been working on SSMS for Data mining, Now I would like to schedule a job. Where I am unable to find SQL Server Agent to schedule a job. Can any one help me how to get SQL server Agent into ...
1
vote
2answers
45 views

Join with comma separated values in SQL Server

I have a table [CourseMaster] LIKE CourseId CourseName ----------------------- 01 ABC 02 DEF 03 GHI 04 JKL 05 MNO 06 PQR 07 ...
2
votes
2answers
25 views

Error 4108: Windowed functions can only appear in the SELECT or ORDER BY clauses

The error in the title is produced when add the second condition in my where clause. I understand the error, have tried using subqueries as seen in other posts to fix this but no luck. Does anyone ...
-3
votes
0answers
25 views

database is not getting restored second time with this query [on hold]

USE master GO ALTER DATABASE Tfs_CoeTest SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO RESTORE DATABASE Tfs_CoeTest FROM DISK = 'D:\Backup123\Tfs_CoeTest' WITH MOVE 'Tfs_CoeTest' TO ...
1
vote
1answer
55 views

Determining the specific command type in a DDL trigger

Given strings corresponding to DDL commands, how can I determine which DDL command (column addition, constraint addition etc.) it precisely is? I have a DDL trigger on a database that will be fired ...
0
votes
1answer
29 views

SQL Server 2012 - Can't detach database on mirror server

I'm running SQL Server 2012 in a mirror configuration and I need to move the mirror's transaction files. I deleted the mirror setup on the primary but I can't detach the databases on the mirror, the ...
4
votes
1answer
46 views

Zero Rows return on quering DMV sys.dm_os_performance_counters

I have a user on SQL Server 2014 Standard Edition (RTM) with SYSADMIN role with Server View State Permissions but when I execute DMV sys.dm_os_performance_counters it return no record. Any idea what ...
4
votes
1answer
106 views

SQL Server data folder access rights

I did a fresh SQL Server 2014 install. Next, I wanted to attach some databases from a previous SQL Server 2012 server. I copied all mdf and ldf files to the data directory, but when I tried to attach ...
2
votes
0answers
15 views

How to ignore spatial index?

When i do Schema Compare in Visual Studio i see that spatial index in table was changed and this changes will included in generated script. But i do not want see this changes in my script. It's ...
-1
votes
1answer
27 views

Unable to restore the database with the query [on hold]

USE master GO ALTER DATABASE Tfs_CoE SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO RESTORE DATABASE Tfs_CoE FROM DISK = 'D:\Backupfolder\Tfs_CoE.bak' WITH MOVE 'Tfs_CoE' TO ...
0
votes
0answers
32 views

Method to economically insert Bill of Materials BOM items into a Stock Table?

I’m new to the wonderful world of database design and I’m currently experimenting with an implementation for my little brother relating to Model Train Sets. [I will be using SQL Server 2012 / Asp.Net ...
0
votes
0answers
11 views

Microsoft SQL Data Services OR SAP Master Data Governance / SAP NetWeaver

I want to know in which cases should I use Microsoft SQL Data Services OR SAP Master Data Governance / SAP NetWeaver, and what advantages bring each one comparing with the others.
1
vote
1answer
39 views

Query to remove duplicate calculated values

I have a client running SQL Server 2008 R2 SP1, and I can't seem to write a query that has distinct calculated values. I could change the schema to store the value being calculated, but I was curious ...
4
votes
1answer
32 views

Calculating daily growth using previous row value in new column - SQL Server

I have the following query below that shows size of a database and when this data was collected. I am trying to create a new column that has "average daily growth" which would be determined by the ...
4
votes
1answer
116 views

Finding distinct rows across two tables: Full Outer Join more efficient than Union?

When finding distinct rows across two tables where we can't necessarily ensure are pre-sorted, is it a good idea to use a FULL OUTER JOIN rather than a UNION? Are there any downsides to this ...
7
votes
2answers
62 views

NoSQL : What is unstructured data?

we are currently running at the edge of resources with our mssql server based solution. We have now many traditional options regarding the next move to tackle the load: buy faster CPUs and IO ...
0
votes
1answer
23 views

SQL query to get output

I have two queries. First query: select files.originalfilename from files inner join digitalfiles on files.fileid = digitalfiles.fileid where digitalfiles.path in ( select * from ...
1
vote
1answer
43 views

How is an idle SQL Server connection causing blocking?

I have a busy, transactional SQL Server (2012) which is having intermittent problems with blocking (every couple of days or so). I've been using extended events to capture blocked-process reports, but ...
1
vote
2answers
51 views

Defragmenting Indexes Bloats Log Files

I'm having difficulty "defragging" indexes as a minimally logged operation. Before defragmentation, the database recovery model is switched from FULL to BULK LOGGED. Depending on the fragmentation ...
0
votes
0answers
22 views

stored procedure to display error messages & success when a sp_refreshview is ran

How can I convert this stored procedure to display error messages when a sp_refreshview fails? I need to know which view failed. I would also like to know which "database_name.SQL_View_object_name" ...
1
vote
1answer
24 views

Sql Server Mirroring Failover and Failback

I have the following mirroring setup for DR. Principal (ServerA) Mirror (ServerB). When we do a DR test we do manual failover from Principal (ServerA) to Mirror(ServerB), so now: ServerB is ...
1
vote
1answer
79 views

What collation to use for Ukraine?

We have an accounting program with an SQL Server database and would like to start a Ukrainian version. I am not sure which collation to use: Ukrainian or Cyrillic_General? With a non-technical ...
0
votes
1answer
15 views

SSDT: Create User in a database not being part of the project

I want to give the user of my SSDT Database Project to be created as a user in another db on the same server and give it permissions to connect and the datareader role. I failed to do so. USE command ...
0
votes
1answer
28 views

How to identify when to change Indexes

We are running a relative small database which when download through bacpac comes as 80MB. But when it runs on Azure it expand to 2GB. In this database, we have couple of main table, but for this ...
2
votes
0answers
21 views

Any way to ensure that Change Data Capture clean up process does not delete the change data that you haven't processed yet?

I'm using CDC feature to track changes that are being made, since the cleanup period is set to 3 days by default, I have to run jobs to archive this change data from the CDC system tables to my ...
1
vote
2answers
35 views

SSIS compatibility

I'm trying to use SSIS for preparing data warehouse and for making business objects for report generator. The problem is that i have to support multiple sql server versions - sql server 2008r2 and ...
1
vote
1answer
26 views

Should I add a clustered Index on a foreign key that is not unique?

I have access to a table that has a primary key unique clustered index on an nvarchar(36). I need to create another table that hangs our own data off that unique clustered index in another table and ...
1
vote
0answers
22 views

Translation of SQL query to compatibility 80

I want to use the following query: SELECT SUBSTRING(qt.TEXT, ( qs.statement_start_offset / 2 ) + 1, ( ( CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.TEXT) ...
1
vote
2answers
25 views

Suggestion for enforcing unique constraint in a table where soft delete is implemented [duplicate]

I am using SQL Server 2014 and in my database, I have a Position table which is structured like this: ID int PK Name nvarchar(50) Unique Index IsDeleted bit A ...
2
votes
2answers
81 views

Maintaining SQL Server 2008 R2 on Windows 10

I have to run SQL Server 2008 R2 on Windows 10 but it is not supported and so I am not getting any updates. Installing a later version of SQL Server is not an option. I can find all the service packs ...