sql-server-2012

Connection string for SQL Server Express on remote Computer login failed error

☆樱花仙子☆ 提交于 2019-12-08 05:28:45
问题 I recently asked the question at this address: Remote SQL Server connection string That thread has helped us arrive at this connection string: SqlConnection connection= new SqlConnection("Server=2.221.1.145;Database=Database;User Id=Andy-PC\\Andy;Password=mypass"); This throws the error: Login failed for user 'Andy-PC\Andy' This user owns the database and i guess should have access to it....however I remember when trying this style of authentication locally it did not work - which is why I

Update varbinary(MAX) column

。_饼干妹妹 提交于 2019-12-08 04:43:18
问题 I am trying to update a varbinary(MAX) column, it actually stores saved data of a Word file that an user uploaded from a website. What happened was an user uploaded a wrong file so I need to update the column to reflect a correct file. What I did was that in a testing machine I uploaded the correct file so it was saved to the database and I can see and copy the "varbinary(MAX) value" and use it to replace the wrong one The value looks like: 0x504B03041400060008000........FBB9 I tried a

SqlClient.SqlException: The wait operation timed out

我的未来我决定 提交于 2019-12-08 04:19:56
问题 I'm currently trying to create a large amount of test data with numerous insert statements using code similar to below... using (var connection = new SqlConnection(_connectionString)) { using (var command = new SqlCommand(query.ToString(), connection)) { try { connection.Open(); command.ExecuteNonQuery(); return true; } catch (Exception e) { ...... } } } My problem is that I keep getting an error The wait operation timed out and yet when I run the SQL statement that failed from within SQL

SQL Creating a new column with previous dates in new column

帅比萌擦擦* 提交于 2019-12-08 03:34:37
问题 I would Like get below result in SQL Server (Color Coded) The Column Required is How I would like my Dates to be: Or this link http://imgur.com/easxkMH The new dates have to be specific to that ID I was thinking of creating a new column of sequence(1, 2, 3,...) number per ID and another column where it is incremented by 1 (NULL, 1, 2, 3) and then doing a self left join. Please advice on any other procedure and help with the code Thanks 回答1: You can use LEAD and LAG Syntax LEAD (scalar

SQL Query - gather data based on date range - possible variable number of columns

眉间皱痕 提交于 2019-12-08 03:33:07
问题 please forgive my inexperience, I hope this isn't too dumb of a question, I'm stuck and have no where else to turn. I'll keep it to the point: I'm trying to gather payroll data with the results like so: The issue I have is the variable number of columns . I will be given a date range and are required to return an attendance record for each day in the given range, or a null value if no data is present. I'm using WebAPI as middle tier so I have the ability to perform further data manipulation

SQL Server CLR : how to call WCF Service In CLR SQL stored procedure in Visual Studio 2013 database project

只谈情不闲聊 提交于 2019-12-08 03:14:27
I have Visual Studio 2013. I created a database project. I added a CLR stored procedure to that project, and I want to call a WCF service from it. Can anyone help me? I want be able to change service address without changing my assembly, similar to what I can do in web.config with the endpoint section of my WCF client config. I found this after a lot of searching and spend very much time on this in VS 2014 Create Database Project Called "CLR_Test" Create Library For WCF Client "CLR_Service_Client" Add Serivce Refrence of wcf service to "CLR_Test" then add refrence of "CLR_Service_Client" into

Updating table with business day and calendar day

自作多情 提交于 2019-12-08 02:54:06
问题 I have a table in SQL Server 2012 that is updated manually every month to reflect what date is a file expected to come in. The date rule already has values but the expected date column is what is updated manually. If its expected on BD1(Business Day 1) I will update to the first non-weekend day of the month. If its expected on CD1(Calenday Day 1) I will update to the 1st regardless if it falls on a weekday or a weekend and so forth. Is it possible to write an update query where it would loop

Concatenating nvarchar(max) values doesn't seem to work (+= working as =)

坚强是说给别人听的谎言 提交于 2019-12-08 02:43:53
问题 Using SQL Server 2012, I've found that trying to build up a string based on an nvarchar(max) column in a table doesn't seem to work correctly. It seems to overwrite, instead of append. Arbitrary Example: DECLARE @sql nvarchar(max); SELECT @sql = N''; SELECT @sql += [definition] + N' GO ' FROM sys.sql_modules WHERE OBJECT_NAME(object_id) LIKE 'dt%' ORDER BY OBJECT_NAME(object_id); PRINT @sql; This SHOULD print out all the SQL module definitions for all the various dt_ tables in the database,

Cannot register stdole assembly in SQL Server 2012

可紊 提交于 2019-12-08 01:03:31
问题 I am in the process of migrating a SQL Server 2008 to 2012 and running into challenges in creating some of the necessary assemblies for a CLR routine. The routine takes a dependency on stdole.dll , but I am unable to create this assembly. My code is as follows: ALTER DATABASE main SET TRUSTWORTHY ON; create assembly [stdole] from 'C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\stdole.dll' WITH PERMISSION_SET = unsafe I am receiving the following error: Warning: The Microsoft

'AdditionalDeploymentContributors' is not a valid argument for the 'Publish' action

本小妞迷上赌 提交于 2019-12-08 00:57:36
问题 I have a set of views of which only 1 needs to be deployed, a different one in each deployment. Filtering DacPac deployments should do it. I'm aware the out of the box options have improved, but that won't do for my needs. The database is published through SqlPackage it explicitly lists these parameters as valid for the publish action. Yet when I use these, it produces the errors (in red): *** 'AdditionalDeploymentContributors' is not a valid argument for the 'Publish' action. ***