sql-server-2014

Visual Studio 2013 incompatibility with MS SQL Server 2014

做~自己de王妃 提交于 2019-11-27 21:16:34
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 this =================================== An incompatible SQL Server version was detected. (Microsoft.VisualStudio.Data.Tools.SqlEditor) ------------------------------ Program Location: at Microsoft.VisualStudio.Data.Tools.SqlEditor.DataModel.SqlConnectionStrategy.ValidateConnectionForEditor(UIConnectionInfo ci, IServerType server) at Microsoft.SqlServer.Management.UI

Possible to restore a backup of SQL Server 2014 on SQL Server 2012?

徘徊边缘 提交于 2019-11-27 20:57:59
I know that you can't (at least not easily) restore a SQL Server 2012 backup on SQL Server 2008. But how does it work for SQL Server 2014 to SQL Server 2012 ? On database level there is the property to adjust the compatibility mode to any other SQL Server version. How does this helps or work ? Will it only disallow the features from 2014? To be honest I already tried to restore a backup, but 2012 didn't recognize the datafile, so I couldn't click ok Button to start the restore procedure. Did I miss some important option ? marc_s You CANNOT do this - you cannot attach/detach or backup/restore a

T-SQL incrementing counter based on change in a column value

时间秒杀一切 提交于 2019-11-27 19:28:22
问题 I have sample table like below. The table is sorted by another column that is not shown. I need to increment a counter column value based on whenever there is change in the value column. Please see below for an example. How can this be done in T-SQL (SQL Server 2014). ID Value 1 3 2 3 3 2 4 2 5 2 6 3 7 0 8 0 Expected Output: ID Value Counter 1 3 1 2 3 1 3 2 2 4 2 2 5 2 2 6 3 3 7 0 4 8 0 4 回答1: In SQL Server 2012 and later, you have the luxury of 1) analytic functions, and 2) running totals:

Publish DACPAC to SQL Server 2014 using SqlPackage.exe?

前提是你 提交于 2019-11-27 18:22:26
I've been successfully publishing DACPACs to SQL Server 2008-2012 instances using SqlPackage.exe, as installed by SQL Server Data Tools (and typically found in C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin ). However, in attempting to publish a 2014-targeted DACPAC to a SQL Server 2014 instance using this same SqlPackage.exe, I get the following: *** Could not deploy package. Internal Error. The database platform service with type Microsoft.Data.Tools. Schema.Sql.Sql120DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type

How to get the next number in a sequence

风流意气都作罢 提交于 2019-11-27 16:04:06
I have a table like this: +----+-----------+------+-------+--+ | id | Part | Seq | Model | | +----+-----------+------+-------+--+ | 1 | Head | 0 | 3 | | | 2 | Neck | 1 | 3 | | | 3 | Shoulders | 2 | 29 | | | 4 | Shoulders | 2 | 3 | | | 5 | Stomach | 5 | 3 | | +----+-----------+------+-------+--+ How can I insert another record with the next seq after Stomach for Model 3. So here is what the new table suppose to look like: +----+-----------+------+-------+--+ | id | Part | Seq | Model | | +----+-----------+------+-------+--+ | 1 | Head | 0 | 3 | | | 2 | Neck | 1 | 3 | | | 3 | Shoulders | 2 | 29

Partition Function COUNT() OVER possible using DISTINCT

自古美人都是妖i 提交于 2019-11-27 10:25:48
I'm trying to write the following in order to get a running total of distinct NumUsers, like so: NumUsers = COUNT(DISTINCT [UserAccountKey]) OVER (PARTITION BY [Mth]) Management studio doesn't seem too happy about this. The error disappears when I remove the DISTINCT keyword, but then it won't be a distinct count. DISTINCT does not appear to be possible within the partition functions. How do I go about finding the distinct count? Do I use a more traditional method such as a correlated subquery? Looking into this a bit further, maybe these OVER functions work differently to Oracle in the way

The database cannot be opened because it is version 851. This server supports version 782 and earlier. A downgrade path is not supported

℡╲_俬逩灬. 提交于 2019-11-27 06:42:07
问题 I am trying to attach database file in SQL Server. I am getting the below error. The same error I am getting while trying to attach database from Visual Studio. I am using Visual Studio 2013 and SQL Server 2014 Management Studio. My connection string: <add name="Sample" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\M\Desktop\SampleApplication1\App_Data\Sample.mdf;Initial Catalog=SampleDBContext;Integrated Security=True;" providerName="System.Data.SqlClient"/>

Combine OUTPUT inserted.id with value from selected row

感情迁移 提交于 2019-11-27 06:27:32
问题 Running SQL Server 2014 . How can I insert multiple rows from a table and combine the inserted data with the new IDs? Let's look at a stripped-down example! DECLARE @Old TABLE ( [ID] [int] PRIMARY KEY, [Data] [int] NOT NULL ) DECLARE @New TABLE ( [ID] [int] PRIMARY KEY, [OtherID] [int] NULL ) INSERT INTO [dbo].[Test] ([Data]) OUTPUT inserted.[ID], [@Old].[ID] /* <--- not supported :( */ INTO @New SELECT [Data] FROM @Old I need to combine the inserted IDs with the data that is being inserted.

Using GROUP BY with FIRST_VALUE and LAST_VALUE

北城以北 提交于 2019-11-27 05:51:49
问题 I'm working with some data that is currently stored in 1 minute intervals that looks like this: CREATE TABLE #MinuteData ( [Id] INT , [MinuteBar] DATETIME , [Open] NUMERIC(12, 6) , [High] NUMERIC(12, 6) , [Low] NUMERIC(12, 6) , [Close] NUMERIC(12, 6) ); INSERT INTO #MinuteData ( [Id], [MinuteBar], [Open], [High], [Low], [Close] ) VALUES ( 1, '2015-01-01 17:00:00', 1.557870, 1.557880, 1.557870, 1.557880 ), ( 2, '2015-01-01 17:01:00', 1.557900, 1.557900, 1.557880, 1.557880 ), ( 3, '2015-01-01

How to restore SQL Server 2014 backup in SQL Server 2008

≡放荡痞女 提交于 2019-11-27 04:49:39
问题 Were there any changes in this area with SQL Server 2014? I’ve seen this post Is it possible to restore Sql Server 2008 backup in sql server 2005 and I know that this was not possible as a scenario for 2012 -> 2008 but I wonder if MS made any changes here with the 2014 version. We are evaluating 2014 version and we have a fairly large database in testing. We’d like to restore a backup of that database to SQL Server 2008 because that physical machine has more space, RAM,… I’m getting standard