sql-server-2014

Could not find server 'server name' in sys.servers. SQL Server 2014

二次信任 提交于 2019-12-18 05:41:46
问题 I recently upgraded our SQL Server from 2005 to 2014 (linked server) and I am noticing that one of the stored procedures which calls the exec command to execute a stored procedure on the upgraded linked server is failing with the error Could not find server 'server name' in sys.servers.Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers. The issue is that the linked server exists and I have done

SQL Server : Split string to row

孤人 提交于 2019-12-18 05:21:32
问题 How to turn data from below: CODE COMBINATION USER 1111.111.11.0 KEN; JIMMY 666.778.0.99 KEN 888.66.77.99 LIM(JIM); JIMMY To CODE COMBINATION USER 1111.111.11.0 KEN 1111.111.11.0 JIMMY 666.778.0.99 KEN 888.66.77.99 LIM(JIM) 888.66.77.99 JIMMY I know in SQL Server 2016 this can be done by split string function, but my production is SQL Server 2014. 回答1: With this TVF, you can supply the string to be split and delimiter. Furthermore, you get the sequence number which can be very useful for

Incorrect syntax near 'THROW'

我怕爱的太早我们不能终老 提交于 2019-12-18 04:29:16
问题 IF @SQL IS NOT NULL BEGIN BEGIN TRY EXEC sp_executesql @SQL PRINT 'SUCCESS: ' + @SQL END TRY BEGIN CATCH SET @ErrorMessage = N'Error dropping constraint' + @CRLF + 'Table ' + @TableName + @CRLF + 'Script: ' + @SQL + @CRLF + 'Error message: ' + ERROR_MESSAGE() + @CRLF THROW 50100, @ErrorMessage, 1; END CATCH END When the CATCH executes, I get the following error: Msg 102, Level 15, State 1, Line 257 Incorrect syntax near 'THROW'. Replacing THROW with PRINT @ErrorMessage works. Replacing

SSIS: script task (vs15) not work when deploy on sql server 2014

无人久伴 提交于 2019-12-17 20:25:02
问题 The error: There was an exception while loading Script Task from XML: System.Exception: The Script Task uses version 14.0 script that is not supported in this release of Integration Services. To run the package, use the Script Task to create a new VSTA script. In most cases, scripts are converted automatically to use a supported version, when you open a SQL Server Integration Services package in %SQL_PRODUCT_SHORT_NAME% Integration Services. at Microsoft.SqlServer.Dts.Tasks.ScriptTask

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

你离开我真会死。 提交于 2019-12-17 16:00:57
问题 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

Difference between In Memory OLTP v.s. Temp table

北慕城南 提交于 2019-12-13 10:56:06
问题 SQL Server 2014 has a new feature called In Memory OLTP and it could store tables in memory. Temp table could do the similar thing by caching the temp table in memory. So, is there any difference? and How about the performance of these two ways? 回答1: There is so much difference between in memory OLTP and the contents of a temp table being stored in memory, that no succinct answer would really do it justice. They're apples and oranges. Additionally, the benefits of in-memory OLTP versus any

SQL - pick current date from machine and compare the year

老子叫甜甜 提交于 2019-12-13 09:42:35
问题 Scenario 1: Current Year Always code needs to pick The last Sunday of January for the current year. For ex(31-01-2016) Current code - picks 1st of Jan 2016 convert(date,DATEADD(yy, DATEDIFF(yy, 0, getdate()), 0)) Scenario 2: Last Year Always code needs to pick The last Sunday of January for the Previous year. For ex(01-02-2015) Current code - picks 1st of Jan 2015 convert(date,DATEADD(yy, DATEDIFF(yy, 0, dateadd(YEAR, - 1, getdate())), 0)) Instead of hard coding the date. I would like to pick

CROSS APPLY Creating Additional Records

时光毁灭记忆、已成空白 提交于 2019-12-13 08:21:17
问题 I am trying to create a report that display potential duplicate records based on three criteria: the last 4 of an SSN, last name and DOB. I posted a question here on the issue and received an answer that I should be using a Cross Apply to unpivot the data. The query runs fast and the results look better than my original query. The new query is below and I have added a filter to show two examples that I am seeing occur across the data: DECLARE @StartDate DATE = '1/1/2017', @EndDate DATE = '3/1

how to get data from SQL server ToCityId And FromCityId Bases

别等时光非礼了梦想. 提交于 2019-12-13 08:03:29
问题 I have below query I want to show data fromCityId AND ToCityId . Suppose passenger travel fromCity London toCity Manchester. How do I write query like this, when I use where clause and in , its show me same values in fromcity and tocity Expected results are in below Picture Select vh.VoucharId,fCity.CityName as FromCity, tCity.CityName as ToCity, InDate from VoucharHotel vh inner join City fCity on vh.City = fCity.CityId inner join City tCity on vh.City = tCity.CityId where vh.InDate between

How can I achieve row level security in SQL Server 2014

前提是你 提交于 2019-12-13 03:04:30
问题 Is there any way to get row-level security in SQL Server 2014? My problem is: I have a table with data for multiple regions I created a view for each region Specific user will have access to specific region views But without giving access to the underlying table, those users are unable to access the views I need to restrict users to view only certain rows. Are there any possibilities to do so? 回答1: I have achieved it by creating views for the specified rows and giving permission to only views