Questions tagged [sql-server-2014]

Use this tag for questions specific to the 2014 version of Microsoft's SQL Server database engine. SQL Server 2014 is the predecessor of the later SQL Server 2016.

SQL Server 2014 (codename Hekaton, version 12.00), released in April 2014, is the successor to SQL Server 2012 and the predecessor of the newer version of Microsoft's SQL Server database engine SQLServer 2016.

This tag covers questions specific to the 2014 version of the database engine. It is recommended that the tag is also used when tagging questions with this version specific tag.

Read more about SQL Server 2014 from MSDN.
Get SQL Server 2014 from here.

4735 questions
22
votes
4 answers

DACPAC schema compare runs before pre-deployment scripts during publish

When publishing a dacpac with sqlpackage.exe, it runs Schema Compare first, followed by pre-deployment scripts. This causes a problem when, for instance, you need to drop a table or rename a column. Schema Compare was done before the object was…
21
votes
9 answers

Searching an int column on the basis of a string value

I have a View View_Booking in sql server 2014: bkID bkSlot bkStatus ---- ------ -------- 2 Lunch 1 4 Lunch 1 6 Dinner 0 7 Lunch 1 While in c# I have used a gridview and casted bkStatus into string…
user1773603
21
votes
3 answers

SQL Server bug or feature? Decimal numbers conversion

I am experiencing some strange behavior in SQL Server when working with decimal and numeric data types. I have a formula that calculates a specific value (4.250), and I'm using the same rounding and casting operations in all cases. However, I'm…
21
votes
3 answers

SQL create database if not exists, unexpected behaviour

I have a long stored procedure which begins with the following statement: IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = N'DBNAME') BEGIN CREATE DATABASE [DBNAME] END; It is expected to create the DB on my local server, if…
StefanL19
  • 1,476
  • 2
  • 14
  • 29
21
votes
4 answers

How to store longitude & latitude as a geography in sql server 2014?

I have locations in longitude and latitude coordinates. My goal is eventually to be able to select all rows from myTable Where distance is less than 2km. How can one use the longitude and latitude to store location within a geography…
Mattias
  • 2,929
  • 5
  • 29
  • 46
20
votes
3 answers

SQL Server xp_delete_file parameters

Who can explain list of xp_Delete_file parameters in sql server. I don't find msdn document for this stored procedure. I got script of xp_Delete_file from maintenance plan but didn't understand first parameter.
mehdi lotfi
  • 11,194
  • 18
  • 82
  • 128
20
votes
4 answers

Visual Studio 2013 incompatibility with MS SQL Server 2014

I downloaded MS SQL Server 2014 Enterprise Edition from MSDN. I want to do a server backend in C# and MS SQL, but the problem is, whenever I want to do something with DB in Visual Studio 2013 Ultimate it just tells me…
19
votes
5 answers

Rounding dates to first day of the month

I am using SQL Server 2014 and I am working with a column from one of my tables, which list arrival dates. It is in the following format: ArrivalDate 2015-10-17 00:00:00.000 2015-12-03 00:00:00.000 I am writing a query that would pull data from the…
user3115933
  • 4,303
  • 15
  • 54
  • 94
19
votes
3 answers

New cardinality estimator (SQL Server 2014) is way off

I have a data warehouse database and I'm facing problems with the new cardinality estimator of SQL Server 2014. After upgrading the database server to SQL Server 2014 I have observed a big difference in query performance. Some queries are executing…
saso
  • 754
  • 7
  • 18
17
votes
6 answers

How to insert values into two tables with a foreign key relationship?

I created two tables: Table tblStaff with columns id (primary key, auto increment), name, age, address Table tblRoleOfStaff with columns id (primary key, auto increment), StaffId (foreign key to tblStaff), RoleId I have form to create new staff…
Ca Pham Van
  • 316
  • 1
  • 3
  • 12
17
votes
9 answers

How to fix error "SQL Server Agent stopped automatically"?

I'm using SQL Server 2014 and having a problem. In Task Manager, on Services tab, I found SQLAgent$VILLBE_SQLSERVER (VILLBE is my computer name), right click and Start. It started and... stopped after 1 second. Then, I open services.msc, and Start…
user4090029
16
votes
3 answers

The value is returned instead of NULL when using function with OUTER APPLY

I am getting strange results when using inline function. Here is the code: IF EXISTS ( SELECT * FROM sys.objects AS o WHERE name = 'vendor_relation_users' ) DROP FUNCTION dbo.vendor_relation_users; GO CREATE FUNCTION [dbo].[vendor_relation_users] ( …
Dmitrij Kultasev
  • 5,447
  • 5
  • 44
  • 88
16
votes
1 answer

Why doesn't SQL Server use the index on the computed column?

Given the following in a SQL Server 2014 DB: create table t ( c1 int primary key, c2 datetime2(7), c3 nvarchar(20), c4 as cast(dbo.toTimeZone(c2, c3, 'UTC') as date) persisted ); create index i on t (c4); declare @i int =…
16
votes
2 answers

SQL Server 2014 installation stuck (hung up) or taking very long time to finish

I'm trying to install SQL Server 2014 but it stays in the same spot (Install_VCRuntime_Cpu32_Action) for hours. It's already the third time I'm trying to install so I don't know what else to do. SQL Server 2014 Installation
Holydead
  • 175
  • 1
  • 1
  • 11
15
votes
4 answers

How can I update a table to insert decimal points at a fixed position in numbers?

I am using Microsoft SQL Server 2014 and have a table with three columns and the field data type is Decimal(38,0). I want to update each row of my table to insert a decimal point after the first two digits. For example, I want 123456 to become…
Javad Abedi
  • 492
  • 1
  • 6
  • 21