sql-server-2012

What is the connection string for localdb for version 11

徘徊边缘 提交于 2019-12-17 03:07:37
问题 I'm trying to do the Code First Walkthrough of the entity framework ( http://blogs.msdn.com/b/adonet/archive/2011/09/28/ef-4-2-code-first-walkthrough.aspx ). I have the latest SQL Server Express and when I check my versions available via command line ( sqllocaldb info ): I see localdbApp1 and v11.0. When I try to run the walkthrough with a few minor tweaks, I get a can't connect error. My app.config looks like this: <parameter value="Server=(LocalDB)\v11.0; Integrated Security=True;

XML Server XML performance optimization

不打扰是莪最后的温柔 提交于 2019-12-17 02:32:16
问题 I've got 34 rows in a database, each row has a column containing xml - the xml is actually in an NVARCHAR(MAX) column not an XML column. For each row I am selecting values in the xml elements as a single resultset. The performance is pretty poor. I've tried two different queries. The first takes roughly 22 seconds to execute and the second takes 7. Even at 7 seconds, this is far slower than optimal, I'm hoping for 1-2 seconds at most. So then I read a rumor online that if you convert the

Extract last name, first name and suffix into separate columns

邮差的信 提交于 2019-12-14 03:57:46
问题 I was wondering if someone could provide me an easy way to extract the names into different columns as below. There is a comma after the Last Name and space between First Name, Middle Initial, and Suffix. Greatly appreciate it. Stored Data: Name Walker,James M JR Smith,Jack P Smith,Whitney Required result: LastName FirstName Suffix Walker James JR Smith Jack Smith Whitney Tried Code: select top 5 Name, LEFT(Name, CHARINDEX(',', Name) - 1) AS LastName, right(Name, len(Name) - CHARINDEX(',',

SQL IF block code causing error even though it shouldn't execute

跟風遠走 提交于 2019-12-14 03:52:59
问题 I have a case in which I have SQL code with an IF-ELSE block. The code in the IF portion should not be reached, but I still get an error when the SQL executes. In the code I first test for the linked server, and when that fails, @reval is set to 1 and the ELSE block should execute and avoid the code in the IF block that needs to query the linked server, but I get this error: Msg -1, Level 16, State 1, Line 0 SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].

An INSERT EXEC statement cannot be nested. Dealing with error

一世执手 提交于 2019-12-14 03:52:59
问题 Not duplicate. The problem here is it has different structure. and I have some restrictions of what I can change and what I can't. Here I have exact example, which other tickets don't. OPENROWSET cannot be applied either, because test1 loops through all dbs ( using EXEC sp_MSforeachdb @sql) . And I can't use it, because in OPENROWSET you have to specify from which db you are running procedure Suppose I have these two SPs: create procedure test1 @ProcName varchar(155) as begin if OBJECT_ID(

SQL query working fine in SQL Server 2012, but failed to execute in SQL Server 2008 R2

点点圈 提交于 2019-12-14 03:52:45
问题 I have a table called MyTextstable (myTextsTable_id INT, myTextsTable_text VARCHAR(MAX)) . This table has around 4 million records and I am trying to remove any instance of the ASCII characters in the following range(s) the VARCHAR(MAX) column myTextsTable_text . 00 - 08 11 - 12 14 - 31 127 I have written the following SQL query, which is taking under 10 minutes on SQL Server 2012, but failed to execute on SQL Server 2008 R2 even after two hours (so I stopped the execution). Please note I

Get all Items sold based on a collection of Items from a master table in SQL Server

余生颓废 提交于 2019-12-14 03:36:05
问题 I have an Item Table where all transactions are stored by different site location and business date, I also have a key for each order stored.My item table structure is as below: Item Table SiteID BusinessDate ItemName Units Sold Units Sale ItemNo OrderNo ---------------------------------------------------------------------------- 1 06/08/2018 Apple 1 5 10001 122-1 1 06/08/2018 Coffee 1 16 10002 122-1 1 06/08/2018 Bread 2 7 10003 122-1 1 06/08/2018 Beans 9 18 10004 122-1 1 06/08/2018 Apple 2 5

SSIS 64 bit vs 32 bit

牧云@^-^@ 提交于 2019-12-14 03:25:53
问题 I am developing an SSIS package in VS 2012 that is being deployed to SQL Server 2012. The package is pulling data from an external database with a 32 bit driver and loading it into SQL Server 2012. I have the package set up so that it is using project parameters to store the connection strings. I can run the package from VS and I can also run the package via 32 bit dtexec. I cannot run the package from the SQL agent. I have the job set up so that it is using a ssis proxy account. I have also

SQL Server: composite PK issue when columns having different data type [closed]

我是研究僧i 提交于 2019-12-14 03:21:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . see my code it is not working but could not understand why? i was trying to create composite pk having columns with different data type when i tried this CREATE TABLE [dbo].[ControllerActionItems]( [ControllerName] [varchar](50) NULL, [ActionName] [varchar](50) NULL, [RoleID] [int] NULL, primary key (

Dynamically interpolate extra rows in SQL query

南楼画角 提交于 2019-12-14 03:12:56
问题 I am using SQL Server 2012. I have the following query: SELECT p.PortfolioGroupID, p.PortfolioGroupCode, p.DisplayOrder, p.MemberCode, m.ContactCode, m.Custom01, 'Separator' As 'PDFType' FROM [APXFirm].[AdvApp].[vPortfolioGroupMemberFlattened] p LEFT OUTER JOIN [APXFirm].[AdvApp].[vPortfolioInterestedParty] m on p.memberid = m.PortfolioID WHERE m.ContactCode is not null and p.PortfolioGroupCode like '%_Package' order by m.ContactCode, p.MemberCode Current Result Set PortfolioGroupID