sql-server-2012

Occasionally Getting SqlException: Timeout expired

我们两清 提交于 2019-12-18 03:05:19
问题 I have application running on my server. The problem with this application is that daily I am getting nearly 10-20, System.Data.SqlClient.SqlException Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding only one of my SP. Here is my SP, ALTER PROCEDURE [dbo].[Insertorupdatedevicecatalog] (@OS NVARCHAR(50) ,@UniqueID VARCHAR(500) ,@Longitude FLOAT ,@Latitude FLOAT ,@Culture VARCHAR(10) ,@Other NVARCHAR(200) ,@IPAddress VARCHAR(50) ,

Sql Server SSIS package Flat File Destination file name pattern (date, time or similar)?

不打扰是莪最后的温柔 提交于 2019-12-17 23:25:46
问题 I'm scheduling a SSIS package for exporting data to flat file. But i want to generate file names with some date information, such as foo_20140606.csv Is it possible? Thanks 回答1: With the help of expressions you can make connection dynamic. Select your flat file connection from Connection Managers pane. In Properties pane, click on Expression(...). Then choose ConnectionString Property from drop down list and in Expression(...) put your expression and evaluate it. Expression build - For day :

New Line Issue when copying data from SQL Server 2012 to Excel

大城市里の小女人 提交于 2019-12-17 21:49:19
问题 I recently upgraded to SQL2012 and am using Management Studio. One of my columns in the database has a CHAR(13) + CHAR(10) stored in it. When I was using SQL Server 2008, this would copy and paste completely fine into Excel. Now, however, copying and pasting the same data creates a new line/ carriage return in the data I have in Excel. Is there a setting I missed in SQL2012 that will resolve this issue? I don't want to simply REPLACE(CHAR(13) + CHAR(10)) on every single database selection, as

Replace row value with empty string if duplicate

北战南征 提交于 2019-12-17 20:31:01
问题 is it possible to replace row value with empty string if duplicate value found? For example SELECT ProductCode, Color FROM Product -------------------- ProductCode | Color -------------------- 00A0B | Red 00A0B | Blue 00A0C | Red 00A0C | Black 00A0C | White -------------------- to -------------------- ProductCode | Color -------------------- 00A0B | Red | Blue 00A0C | Red | Black | White -------------------- I'm using SQL Server 2012. 回答1: Often, this type of transformation is better done at

How to encode language specific chars while converting varbinary() to varchar(max) in SQL Server 2012?

情到浓时终转凉″ 提交于 2019-12-17 19:54:19
问题 I am trying to convert a database column DATA from varbinary() to varchar(max) in SQL Server 2012. I am using this code to handle the conversion: SELECT CONVERT(VARCHAR(MAX), DATA) FROM [dbo].[TABLE_NAME] and the resulting row is as follows : VW 6501 Çamaşır I am having trouble with language specific characters (language is Turkish in my case for now) How do I get over this encoding problem in SQL Server 2012? Is there a generic way to do this conversion for any language, considering loss

Code first custom SQL migration timeout exception

老子叫甜甜 提交于 2019-12-17 19:12:19
问题 I am trying to create FULL TEXT index using Entity Framework Migration by executing custom Sql. My migration class looks like this: public partial class DocumentContentFullTextIndex : DbMigration { public override void Up() { AlterColumn("dbo.Attachments", "ContentType", c => c.String(maxLength: 260)); Sql("CREATE FULLTEXT CATALOG FullTextIndexes AS DEFAULT;", true); Sql(@"CREATE FULLTEXT INDEX ON [Attachments]( Content TYPE COLUMN ContentType Language 'ENGLISH' ) KEY INDEX [PK_dbo

SQL Server Pre-Login Handshake Acknowledgement Error [duplicate]

你离开我真会死。 提交于 2019-12-17 18:26:36
问题 This question already has answers here : Connection to SQL Server Works Sometimes (21 answers) Closed 4 years ago . We have a production website with a mixture of classic ASP, inline .Net and compiled .Net that talks to a SQL Server instance where both are VMs on the same physical box and everything there works great. In order to do some testing with new features I created a QA version of the site and have it setup to connect to a database on a VM hosted on another physical server. They are

Get the nearest longitude and latitude from MSSQL database table?

*爱你&永不变心* 提交于 2019-12-17 18:10:02
问题 Ok I have searched SO and Google but haven't really found a definitive answer so throwing it out there for the SO community. Basically I have a table of longitudes and latitudes for specific points of interest, the sql query will know which location you are currently at (which would be one of those in the table, passed in as a parameter), therefore it then needs to calculate and return the one row that is the nearest latitude and longitude to the passed in one. I require this to all be done

Find Locked Table in SQL Server

蓝咒 提交于 2019-12-17 17:27:10
问题 How can we find which table is locked in the database? Please, suggest. 回答1: You can use sp_lock (and sp_lock2 ), but in SQL Server 2005 onwards this is being deprecated in favour of querying sys.dm_tran_locks: select object_name(p.object_id) as TableName, resource_type, resource_description from sys.dm_tran_locks l join sys.partitions p on l.resource_associated_entity_id = p.hobt_id 回答2: sp_lock When reading sp_lock information, use the OBJECT_NAME( ) function to get the name of a table from

Register CLR function (WCF based) in SQL Server 2012

≡放荡痞女 提交于 2019-12-17 16:57:36
问题 I have a CLR based stored procedure which used MsmqIntegrationBinding to post messages to remote MSMQ's. Everything was working fine in SQL Server 2005 but now there is an upgrade from 2005 to 2012 suppose to happen. I tried to register the CLR (SP) in SQL Server 2012 but while registering System.ServiceModell.DLL it came up with the following error. Msg 6544, Level 16, State 1, Line 1 CREATE ASSEMBLY for assembly 'System.ServiceModel' failed because assembly 'microsoft.visualbasic.activities