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
65 views

OS Paging too high in sql server

For one of my servers with below configuration: Total RAM: 32 GB CPU: 8 Max Server Mem: 22.5 GB Min Server:: 4 GB Edition: Enterprise Edition with 2k8R2 installed on SP3 ...
3
votes
2answers
66 views

Is there a way to grant SELECT for every database (including new ones) at a server level?

I have a unique (well, I think it is unique) situation where databases (yes, entire databases) can be created more or less dynamically. Ignoring the obvious issue with that, I need to be able to ...
-2
votes
1answer
20 views

Delete into SQL Server loop [closed]

In case of repetition periods, need to delete the second occurrence (15 to 15 minutes), but the query always returns all or nothing. DECLARE @DatAteTemp DATE DECLARE @HorAteTemp TIME DECLARE ...
1
vote
2answers
73 views

Reuse a complex non-deterministic expression in SELECT and WHERE clauses

I have a query like this: -- This is inefficient, and may even be wrong if expression is nondeterministic SELECT TOP 10 team_name,score_points=<big expression> FROM teams WHERE <big ...
3
votes
2answers
104 views

Changing metadata changes query output issue [duplicate]

Recently stumbled across the following problem: changing metadata changes query output. Here is how to get it. CREATE TABLE [dbo].[prod] ( [ID] [tinyint] NOT NULL, [values] [tinyint] NOT NULL ) GO ...
0
votes
3answers
45 views

Reset Key Names to Defaults?

I'm working with some tables/columns that were renamed at some point, but the names of the primary/foreign keys are still based on the previous names. In SSMS is there any (preferably automatic) way ...
1
vote
2answers
61 views

Downgrade SQL Server Enterprise Edition to SQL Server Standard Edition

There is a requirement in our project where they want to evaluate if it is possible to downgrade SQL Server from Enterprise to Standard edition and if a server can be decommissioned. Kindly guide me ...
0
votes
1answer
24 views

SQL Server 2012 Replication, how to ignore action with specific trigger?

SQL Server 2012. Database is in merge replication, no conflicts presented. Current example is simply for understanding, but real schema is very huge to describe. Schema and trigger at SQLFiddle for ...
2
votes
0answers
23 views

Replication stopped working, no errors

I have a TOP server (SQL Server 2012) with a merge replication to around 4 other servers. When I subscribe to the publication, everything is downloaded fine to the subscriber. The insert of one of ...
2
votes
3answers
214 views

Cascade primary key update to all referencing foreign keys

Is it possible to update a primary key column value with cascading the update among all the foreign keys referencing it ? # EDIT 1: When I run followinq query select * from sys.foreign_keys where ...
0
votes
1answer
34 views

Unable to install

Unable to install SQL Server 2008 in windows 8.1 64 bits it asks for .Net Framework 2.0 but I have already installed .Net Framework 4.5 with the OS.
1
vote
1answer
79 views

Does “Synchronous-Commit Availability Mode” ensure consistency between Replicas?

If one refers to the MSDN documentation, on Synchronous-Commit Availability Mode, you may read: Under synchronous-commit availability mode (synchronous-commit mode), after being joined to an ...
0
votes
2answers
58 views

SQL server permissions during installation

I'm trying to find out when a SQL server installation grants permissions on the OS. I know that the following permissions are giving during setup msdn article about permissions. However what I don't ...
0
votes
0answers
34 views

The underlying provider failed on Open. Error in Windows Service

I have a Windows Service(c#) that receives data and inserts it into DB using Entity Framework 6. Database is SQL Server 2014 Enterprise Edition. Both (Service and DB) are hosted on VPS( Windows Server ...
1
vote
1answer
40 views

Which Indexes in which situations is more efficient in SQL Server 2012

I use SQL Server 2012. I want know when I want to know in what situation I have to use CREATE NONCLUSTERED COLUMNSTORE INDEX .... and in what situation I have to use Create NonClustered Index... ...
1
vote
1answer
105 views

T-SQL View — How to 'pre-fetch' schema using scalar function, then populate using table query

I have an application that uses T-SQL views. A number of these views are quite complex, joining data from many tables. To avoid column-name collisions, the views often employ table-scalar functions to ...
1
vote
1answer
31 views

Is it good or bad practice to have a fact table relate to the same dimension table multiple times?

I'm new to DW/BI, and this seems like a pretty basic question, but I can't seem to find a good answer. I have a fact table that would have more than one date associated with it, so I was thinking ...
0
votes
1answer
40 views

Importing a Foxpro Database

I have a Fox Pro database (one DBC and a bunch of DBF files) that I want to import into SQL via the Import and Export wizard. I downloaded the FoxPro ODBC driver. I managed to get to the screen that ...
2
votes
1answer
78 views

Prevent Subscription to report from running on a holiday

I have a SQL Server that I am using for building and distributing reports. I have built all the packages for importing data as needed as SSIS packages. These reports only need to be run after the ...
2
votes
1answer
63 views

Why choose a top query and temporary table instead of a cursor for a loop?

When it comes to looping over a large set of data in T-SQL, the majority of examples I see on the Internet use a pattern like this: declare @someVariable int declare @remainingRows int select ...
1
vote
1answer
33 views

How to find missing data from one table that is a join of 2 other tables

I have 2 tables, stock and location, with a third table that records the level of stock at each location, stock_loc_info. Each stock item should have a record for each location. What SQL query ...
2
votes
1answer
74 views

SQL Hard Drive Config?

I am setting up new server and am a little confused in my research of HD configuration. My main question is : Is it recommended to have the Trans Logs and DB logs (ldf) on separate spindles or can ...
2
votes
2answers
60 views

space usage on sys.allocation_units and sp_spaceused

It is a known fact that the DMVs dont hold accurate information regarding number of pages and count of rows. However, when you have the stats updated, I can't see why they wouldn't. I am working on a ...
1
vote
1answer
39 views

SQL Server 2012 Execution Plan

I was reading through Kendra Little's post on www.brentozar.com http://www.brentozar.com/archive/2013/08/query-plans-what-happens-when-row-estimates-get-high/ In the post, Kendra mentioned that she ...
0
votes
2answers
65 views

60 minutes to shut down sql server service?

We recently merged with a new company and they have a server that has 265 DBs on it (6.6tb of mdfs). Shortly after we merged the other DBA said it takes 60 minutes to shut down the services which I ...
4
votes
6answers
141 views

Select rows with same id but null and some other value in another column for that id

I want to get only rows having a value NULL and some other value than NULL for a particular username column. If both rows have null for that particular username or both have some values other than ...
2
votes
1answer
23 views

How to format documentation in MS_Description extendedproperties?

I'm using a 'MS_Description' extended property to document parameters in a stored procedure. This parameter's documentation requires more structure than just plain text. That is I would like to ...
0
votes
1answer
34 views

Generate Schema and Data to SQL script and Run it on another DB programmatically

I can manually generate a schema with data via Table Name > Tasks > Generate Scripts... But it is possible to create a schema+data single sql file backup of a database and run it on another database ...
1
vote
2answers
70 views

Writing a large update/delete script that doesn't provoke locks

While running a T-SQL script that is performing massive amounts of deletes, I had the unpleasant experience of causing some sort of lock contention that prevented inserts of data in some tables for ...
9
votes
2answers
911 views

What significance does an index_id < 256000 have?

In a certain tutorial I read the author is filtering sys.indexes based on the predicate index_id < 256000. What does this accomplish?
9
votes
3answers
145 views

What is a deterministic method for evaluating a sensible buffer pool size?

I'm trying to come up with a sane way to understand if the max server memory (mb) setting is appropriate (either should be lower, or higher, or stay the way it is). I am aware that max server memory ...
0
votes
0answers
23 views

Controlling SQL Backups From Two Machines

I'm far from a DBA, and don't really have a great understanding of backup chains, but I was asked the following question by a network administrator, and wanted to be sure that my answer was correct. ...
0
votes
0answers
31 views

How to tell which process in SQL Server I should kill?

I am having an issue with an application as it is running supper slow. I don't know if it is a database issue or something else as the is nothing that I can find to be the issue. I tried select * ...
8
votes
2answers
185 views

SQL Server : how to create user with access only from specific HOSTNAME or IP addres

I have one stupid app which I rely on, which has hardcoded connection string inside. To increase security of my SQL Server I'd love to make SQL users same as one hardcoded inside app, but I want to ...
0
votes
1answer
21 views

convert update field second to time

I have 2 fields ( about 1000 records) name FROMTIME and TOTIME. Both fields will have time in seconds (for example FROMTIME = 20520 and TOTIME = 39360). I would like to convert and update these ...
0
votes
1answer
35 views

Dynamic Pivot with overlapping years

I have looked and cannot find how to show the last # months in a pivot table. Everything I seem to run across codes months statically. I'm seeking a solution that shows something similar to the ...
4
votes
1answer
267 views

Restarting database server or just the database

I am an application programmer. We have a SQL server 2012 instance that hosts many related databases(around 12 databases). The vendors did some changes to one of the database and the application and ...
1
vote
1answer
63 views

How to get the dependent entities (referencing entities) for an User Defined Function (UDF)

We have a database that has been copied, including stored procedures and some user defined functions. I'd like to check whether a UDF is being used. Is there a way to see which stored procedures ...
-5
votes
1answer
54 views

Select Top Ten Each Group [duplicate]

This my table and and my query ! MyTable This is My query select CellId, PathId, channel, sum(Duration) as min_duration from HourlySummary group by CellId, PathId, Channel order by cellid, ...
0
votes
2answers
50 views

Can an EXISTS clause be improved when the condition is checked for the same value multiple times?

Assume that I'm modelling a Blog engine. Blogs have n Posts. Each User can be granted a role on different Blogs (Admin, Approver or Editor stored as enums/ints). Each Post can have a State (Draft, ...
0
votes
2answers
92 views

Is there any way to access the variables in a dynamic sql which is declared outside the dynamic sql

Is there any way to access the variables in a dynamic sql which is declared outside the dynamic sql. I need to do the following: Query the information schema to get the parameter names to an sp ...
2
votes
1answer
38 views

How to programatically change the login audit settings?

Is it possible to change the login auditing settings of a SQL Server database by script, rather than through the Server Properties Security setting in the SSMS UI? I need to programatically change ...
0
votes
0answers
35 views

Query on a SQL Server view with openquery to Hive returning wrong answer

I have a view in a SQL Server instance which is running an OPENQUERY to Hive through MS OLE DB Provider. The view is getting all the records from the Hive table without any WHERE clause. Now, I ...
0
votes
0answers
23 views

Run a specific SQL Server job step from a stored procedure

I have a job with 5 steps that are scheduled to run after each other. I want to have a stored procedure where a user can execute the stored procedure and give the step number as a parameter. Only ...
3
votes
1answer
257 views

Sql server table insert performance optimization

Setting In a datawarehouse, I am joining a fact table to 20 dimensions. The fact table has 32 million rows and 30 columns. This is a temporary staging table so I don't have to deal with other users ...
-1
votes
2answers
118 views

How to select top 10 records from each category

I have a table with fields Hour, PathId, Duration, Event, CellId, Channel I have 50+ CellId. Each CellId has four PathId (i.e. 0, 1, 2, 3). Each PathId has many Events and Durations. Now I want to ...
0
votes
1answer
37 views

Trying to install sql_server_2014_enterprise_edition_x64_dvd Windows 7(Ultimate) 64Bit OS

Im receiving the following error after the Set-up checks Global rules It shows the following error. any idea why this issue occurs :( ?by the way this machine was formatted yesterday and this is a ...
0
votes
0answers
9 views

Deployed packages getting into the wrong folder

Package in my SSIS when I deploy them are getting save in the File System folder rather than the MSDB folder. Why? How do I change the location of these packages to MSDB?
0
votes
1answer
24 views

Composite Key for Gizmo Tracking

I'm trying to setup a many to many relationship between an gizmo table and a owner table. A owner can have many gizmos And a gizmo can have many owners When I have a linking table do I set the ...
2
votes
2answers
51 views

Execute Remote Powershell script from SQL Agent

A test SQL Server job hangs when it executes a Powershell script. It does work using my login and a Powershell window, but not using the Agent account and a job. The SQL Agent user has ...