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)

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
107 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
43 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
81 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
66 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
75 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
62 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
147 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
72 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
914 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
149 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
190 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
22 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
55 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
51 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
97 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
39 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
36 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
25 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
270 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
120 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
57 views

Trying to install sql_server_2014_enterprise_edition_x64_dvd Windows 7(Ultimate) 64Bit OS [on hold]

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
62 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 ...
1
vote
1answer
33 views

ERD Table and Field Questions

My question is two-fold. First, this is my first design and I am using the Mere Mortals book to help me. He states, "...each table represents a single, specific subject." So should I combine ...
0
votes
0answers
37 views

Loading XML data from SQL Server directly into MarkLogic?

Has anyone loaded XML data from SQL Server to a MarkLogic document store? This would be preferable to dumping XML to file system and then using mlcp. Maybe with SSIS?
1
vote
1answer
77 views

Rebuild index in table with many values

I'm junior DBA ,have table with 11 million values ,one of the indexes is like : CREATE NONCLUSTERED INDEX [ix_mytbl_mycolumn] ON [dbo].[myTbl] ( [my_id] DESC )WITH (PAD_INDEX = OFF, ...
6
votes
2answers
339 views

ROW_NUMBER() without PARTITION BY still generates Segment iterator

I'm writing on an upcoming blog post of mine on ranking and aggregate window functions, specifically the Segment and Sequence Project iterators. They way I understand it is that Segment identifies ...
4
votes
3answers
134 views

SQL Server migration using a replica

I want to migrate a fairly big SQL Server instance (100 GB+) to a cloud machine. I don't think the attach/detach method will be a good idea. Because sending big files over the internet would take a ...
1
vote
1answer
51 views

Best practise how to sync SQL Server 2014 database with other database

What is best practise if we have application using a SQL Server database and we would like to have backup if SQL Server does not work? Our scenario: We would like to use our main SQL Server ...
0
votes
0answers
23 views

Default value for SQL Server CE 4.0 column

I am writing a tool to convert a system from XML data files into a SQL Server CE format. Not the most efficient way to do this, but essentially it will be digesting XML files created by another ...
1
vote
1answer
48 views

Can AlwaysOn cross domains?

Is SQL Server 2014 capable of having AlwaysOn set up across multiple domains? If not, is there a third party tool you can recommend to mirror a 13TB (and growing) database across domains? Thanks in ...
3
votes
2answers
92 views

SQL Server 2008R2 XML Column Index strategy for large tables?

I am working with SQL Server 2008 R2 and some XML columns in a very large table. I understand that I cannot use Selective XML Indexes due to our SQL Server version being < 2012. I'm brand spanking ...
0
votes
1answer
68 views

Replication Madness

Summary We were contracted to build a "Hot-Standby" for a company which keep their data in the cloud. The through-put is relatively low. Database availability/accuracy is a matter of life or death. ...
2
votes
2answers
81 views

Is it possible for increasing the SQL Server max memory limit to degrade performance?

As far as I can tell, raising the SQL Server max memory limit has no drawbacks, provided that sufficient memory is left for the OS and other applications. Assuming this is the case, can there be any ...
4
votes
1answer
267 views

Dropping a table with powershell

Trying to delete an existing table using powershell $srv = new-Object Microsoft.SqlServer.Management.Smo.Server(".\CEF_2014_1") $db = New-Object Microsoft.SqlServer.Management.Smo.Database $db = ...
2
votes
0answers
42 views

Why could a SQL Server table grow far quicker than the data to it?

I've got an audit table in SQL Server 2008 R2 that has the following structure: CREATE TABLE [AuditInstance]( [oid] [int] NOT NULL, [AuditTransactionOID] [int] NULL, [pid] [int] NOT NULL, ...
0
votes
1answer
40 views

How to verify a SSAS Backup and how to perform Integrity Checks in SSAS?

I have a procedure to backup SSAS Databases that is working successfully. I also delete the SSAS backup files that are older than 2 days. What I am looking forward to implement is: 1) How to verify ...