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

Replicate MySQL INSERT to MSSQL table

I'm running into a challenge here trying to "sync" a MySQL table with a MSSQL table. My scenario involves my linux-based website submitting form data submissions to a MySQL database on that web ...
1
vote
3answers
220 views

Incorrect query results for execution plan, unsure of exact cause of problem

We had a query yesterday that was intended to page through results but on the first page of results the query only returned 4 records instead of the expect 25. Changing the query in any way resulted ...
1
vote
2answers
23 views

Upgrade BI server to 2014 and stay on 2008r2 with the database engine server

We would be happy to upgrade our SQL Server environments to 2014, but we have a tight budget for next year. Our BI server (SQL Server 2008 Standard Edition, that is used only for BI purposes) is ...
1
vote
1answer
39 views

What MySQL data types REQUIRE a max length (size) declaration in a create table statement?

I am converting a SQL Server table structure to a MySQL table structure, and I need to know how to properly declare the column data types within the CREATE TABLE statement. I have a CSV file where ...
0
votes
1answer
37 views

Select into existing table where ID is in another table [closed]

I have one table containing ~35k IDs (TableC), one table that features multiple columns (TableA), amongst others the ID from the before mentioned table and a third empty table, featuring the same ...
1
vote
0answers
22 views

Datamining using holidays

My setup: I am currently running a SQLServer 2012 database paired with a SSAS. My database features sales per store at specific times. My goal: I am interested in predicting future sales (amounts) ...
3
votes
2answers
160 views

SET DATEFORMAT problems

I have some doubts about SET DATEFORMAT command. 1)Does this command is only used for inserting and updating date format and it does not effect the date format of that column? OR does this effect my ...
0
votes
1answer
18 views

Copy every entry from TableA to TableB where the ID is in a textfile containing a list of IDs

I have a text file (or an xls) with a 35k lines, each containing a single ID. I'm required to copy every entry of TableA to TableB where the ID is in said list. Would it be best if I'd create a new ...
-3
votes
0answers
33 views

Open tran for Select query [duplicate]

I have seen BEGIN TRAN on queries in my production db, but it is just a SELECT query with NOLOCK option in the transaction. Why would a simple SELECT query be placed inside of a transaction?
0
votes
2answers
32 views

Log Sequence Numbers in Full BackUp and Log Backup

My full back-up starts daily at 02:00 AM. It takes about 3 hours. I also take T-Log back-ups every 15 minutes (at 15,30,45 and 00 hours). I can verify the LSN sequences of T-log backups when I ...
0
votes
1answer
18 views

Sync MySQL with SQL Server 2008

My current project requires a form on my website to populate a table in a MySQL database with data a user submits via the form. This will work great but my complete goal involves getting that data ...
7
votes
1answer
222 views

Statistics. Are multicolumn histograms possible?

I am thinking of a situation where I have two columns with high density but these columns are not independent. Definition Here it is the definition of the table that I have created for testing ...
4
votes
1answer
49 views

What data gets passed between mirroring principal and secondary?

We are trying to figure out which of the below statements is correct when talking about SQL Server mirroring: The master database server executes the query, and takes the resulting transactions and ...
1
vote
2answers
59 views

Find dates when exactly records changed for user

I need to find the dates when exactly the status really changed. Order should be analysed from Start to end period: Start Period : 11-10-2014 End Period : 21-10-2014 Data: ID, Name, ...
0
votes
1answer
50 views

Cannot log in to SQL Server 2008 R2

I have problem with my SQL Server 2008 R2 instance. I want to log in using windows authentication and server name "local", but error 2 is returned. I've tried to login with a server name of "IP ...
2
votes
2answers
63 views

Backup status report from multiple server in sql server 2005

Per daily routine activities of DBA, as we know backups are important to be monitored and to make sure they are corrupt free, i am trying to fetch a report to get such status. Moreover, we have SQL ...
1
vote
2answers
82 views

SQL Server 2012 Table Partitioning - Have I done it correctly?

I have a table that stores accounting transactions for what we call "jobs". The table looks like this: ( REGION char(3) JobNumber char(17) SeqNum decimal(5,0) ..... ..... ..... AcctYear decimal(4,0) ...
4
votes
2answers
204 views

Skip sections that have GO

I'm working on a script I can run on new servers to do some initial configuration. I would like to be able to skip some sections but the problem I'm running into is the "GO" that's required. Because ...
0
votes
0answers
29 views

remote access between 2 projects

I want to make a database program/project with visual basic. I will make 2 programs. In the first program, a basic user-admin will add, make, delete, edit records on database/s. In the second ...
1
vote
2answers
68 views

Security or performance risks using SQL CLR [closed]

Are there any particular security or performance risks in using the CLR in SQL Server ?
2
votes
0answers
36 views

reporting space consumption to files in filegroup - how to reverse-engineer the algorythm spreading data across files

First question, so be gentle ;) I would like to know how to be able to calculate the distribution of data consumed per file in a filegroup, back to the index (HEAP, CLUSTERED, NONCLUSTERED) storing ...
1
vote
0answers
94 views

Most Efficent way WHERE [Date] = Today [duplicate]

Was wondering what would be the most efficient way to get data from today, does converting the date something like WHERE CONVERT(CHAR(8),[DateTimeColumn],112) = CONVERT(CHAR(8),GETDATE(),112) Not ...
3
votes
0answers
45 views

Can SQL Server use a spatial index and another index at the same time and be efficient?

Let's say we have a table that contains two terrain datasets defined by TerrainModelID like below: CREATE TABLE [dbo].[DigitalTerrain]( [DigitalTerrainID] [uniqueidentifier] NOT NULL, ...
0
votes
1answer
33 views

Extracting Data from multiple archive tables(SQL Server)

I am developing a report in report builder 3.0 where i am extracting data from a table dbo.odcalls. now the problem is this table is archived on monthly basis on a seperate database(HN_Backup) and i ...
0
votes
2answers
49 views

Is it advisable to restart a SQL server box running Windows when disk space is low?

We've had a sudden drop in hard drive space on the OS partition of our SQL server (as databases are being stored there). It's causing various issues, and we're unable to move one of the databases, as ...
1
vote
1answer
19 views

SQL Server configuring both UCP and MDW on a single server

I'm trying to configure both UCP and MDW on a sql server. I have already setup UCP and it created [sysutility_mdw] database. Now when i try to setup MDW it is trying to use sysutility_mdw database ...
0
votes
2answers
150 views

Update statement is giving an invalid column name error, even though the column exists

I have a temporary table created at the beginning of this stored procedure. It is created successfully and can be selected from and inserted to. Here is the create statement CREATE TABLE ...
1
vote
1answer
33 views

Wait for an AlwaysOn replica to be synchronized in Powershell

I am working on a disaster recovery script. One part of it is not being consistent. This is the code: ... ## Switch replica to Synchronous Set-SqlAvailabilityReplica -AvailabilityMode ...
1
vote
1answer
67 views

Query to convert the count to million or thousands

I am running a query on a database to return count(*) for number of rows. If the count is greater than million say 2,250,304, I want the query to return 2.25M. If the count is greater than 1000 but ...
2
votes
2answers
65 views

Deleting rows from a table with a very small amount of expansion space

I have multiple tables that I have backed up the data in, and now am deleting the old data for the time, archiving is not an option due to space constraints at this time. I have tried running the ...
1
vote
2answers
59 views

Creating a Linked Server that Points to Itself

I am attempting to create a linked server on SQL Server 2014 instance servername\instancename using the following call: EXEC master.dbo.sp_addlinkedserver @server = N'servername\instancename', ...
0
votes
1answer
35 views

Can we create a stored procedure to copy detached .mdf and .ldf files from original location to new location?

I am trying to create a script to attach database, move .mdf and .ldf files to new location and then attach the database. I created a stored procedure to detach and attach the database. Can I get a ...
2
votes
1answer
184 views

How to allow to execute stored procedures but not writes?

I would like to set up a "reading" user on my SQL Server 2012 instance. I would like to allow him the right to execute any stored procedure, or function, or direct SQL statement, which retrieves data ...
1
vote
1answer
47 views

Stored procedure - problem with merge - Insert

I am calling a stored procedure from my c# code . The procedure works fine for update, but fails for Insert. Is the following merge-insert procedure code correct? Any help is appreciated. Here is ...
1
vote
2answers
62 views

How do I return data from a table where the data is the max date of the previous month's data submissions (-1 of current date)?

I have a stored procedure where I select the latest/max submit_date data for a tracker_date and client from a source table called Tracker_Live, and insert it into a new table called ...
2
votes
3answers
208 views

Finding Database Default Locations

I am working on creating a script to restore database from a backup file to default location of an instance, which is set away from system databases installation folder. Currently, I'm using to find ...
1
vote
2answers
143 views

ONLINE vs OFFLINE index rebuilds

I am looking for an opinion, which I know is usually frowned upon, so my apologies in advance. I'm currently in an environment where every instance is SQL Server enterprise edition. The maintenance ...
1
vote
1answer
85 views

Offsite Log Shipping

We currently use CDC to replicated our Production DB offsite (Microsoft SQL Server 2008 R2), but using CDC and the way we process the files is very unstable. Also note that the two servers cannot ...
5
votes
1answer
233 views

View designer strange join syntax

I have a data warehouse with a lot of views built in with the SSMS view designer. Viewing the syntax, the FROM clauses are unintelligible to me because the ON statements do not follow straight after ...
3
votes
3answers
114 views

A way to clear/restart virtual memory creep automatically?

I know it's not good practice to do this, but my company cannot afford me trying to find a proper solution to our problem. I've read this and I could do the same with SQL Server 2005, but I was hoping ...
-2
votes
2answers
71 views

Install SQL Server 2008 R2 with one click [closed]

How can I install SQL Server 2008 R2 without wizard, just install and voila, install on PC?
0
votes
1answer
67 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 ...
1
vote
2answers
74 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
106 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
65 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
25 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
24 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
218 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 ...