sql-server-2008-r2

SQL Server Import Wizard “workgroup information file” error when importing Access .mdb

吃可爱长大的小学妹 提交于 2019-12-01 04:06:02
Is it possible to import an MS Access. mdb file into SQLExpress if I do not have MS Access installed? Reason I ask is because I am getting the following error when attempting to use the Import Wizard in SQL Management Studio to perform this task: "Test connection failed because of an error initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user." If the .mdb file is encrypted with user-level security then you need to provide the SQL Server import wizard with the username and password to connect to the database, and

SSRS sum max by group

妖精的绣舞 提交于 2019-12-01 03:53:44
I have an SSRS report that looks like this (with additional columns such as sales) with rows grouped by region and location. The goal for the locations is the max for each location as in my query the goal appears on each sales record that I'm summing. =Max(Fields!goal.Value) The goal for the regions is the sum of the max for each location in that region group. =Sum(max(Fields!goal.Value, "LocationName"), "region") Those first two are no problem, but I'm having difficulty getting the grand total for the report which would be the sum of each region total. =Sum(Fields!goal.Value, "region") I can

'Create VIEW' must be the only statement in the batch

爱⌒轻易说出口 提交于 2019-12-01 03:48:29
问题 I have the following SQL: ALTER PROCEDURE [dbo].[usp_gettasks] @ID varchar(50) AS declare @PDate Date WHILE (DATEPART(DW, @PDate) = 1 OR DATEPART(DW, @PDate) = 7 ) BEGIN set @PDate = DATEADD(day, 1, @PDate) END CREATE VIEW tblList AS select tt.ItemOrder,tt.DisplayVal, DATEADD(day, tt.DaysDue, @PDate) from tblLine tt where tt.ID = 1 I get the following message: Incorrect syntax: 'Create VIEW' must be the only statement in the batch I tried putting GO before Create View , but then it can't

How to handle users and logins in Visual Studio Database Project?

情到浓时终转凉″ 提交于 2019-12-01 03:39:15
I've built a database in SQL Server 2008 R2 and am using Visual Studio 2010 Ultimate to create a database project for it. I've created both a SQL Server project and Database project to represent my environment based on this MSDN walkthrough . The schema comparisons for both projects work as expected and I'm able to replicate all changes server to project. However, it seems to have imported some environment specific configuration, such as logins, user/login mapping, local service accounts (e.g. NT SERVICE\MSSQL$SQLEXPRESS2008), etc. This seems not ideal because my impression was this database

SQL Server search in nvarchar & ntext

旧时模样 提交于 2019-12-01 03:11:47
问题 I'm using SQL Server 2008 as my database engine in a VS2010, C# ASP.NET web app. My project is Farsi (Persian) so I've used nvarchar and ntext as my data types. I use following query to find rows from my database but nothing is returned, while I have a row with the specified keyword. Of course my keyword is in Persian (unicode). What is going wrong here? Is it because of using Farsi language? How can I search in nvarchar and ntext columns containing unicode characters? myCommand = new

how i can remove all NewLine from a variable in SQL Server?

血红的双手。 提交于 2019-12-01 03:03:25
how i can remove all NewLine from a variable in SQL Server? I use SQL Server 2008 R2. I need remove all NewLine in a variable in a T-Sql Command. For example : Declare @A NVarChar(500) Set @A = ' 12345 25487 154814 ' Print @A And it printed like this 12345 25487 154814 But i want get string like this 12345 25487 154814 I write this query but it not work : Set @A = Replace(@A,CHAR(13),' ') Ardalan Shahgholi You must use this query Declare @A NVarChar(500); Set @A = N' 12345 25487 154814 '; Set @A = Replace(@A,CHAR(13)+CHAR(10),' '); Print @A; OzrenTkalcecKrznaric If you want it to look exactly

Transaction context in use by another session

孤者浪人 提交于 2019-12-01 02:55:34
I have a table called MyTable on which I have defined a trigger, like so: CREATE TRIGGER dbo.trg_Ins_MyTable ON dbo.MyTable FOR INSERT AS BEGIN SET NOCOUNT ON; insert SomeLinkedSrv.Catalog.dbo.OtherTable (MyTableId, IsProcessing, ModifiedOn) values (-1, 0, GETUTCDATE()) END GO Whenever I try to insert a row in MyTable , I get this error message: Msg 3910, Level 16, State 2, Line 1 Transaction context in use by another session. I have SomeLinkedSrv properly defined as a linked server (for example, select * from SomeLinkedSrv.Catalog.dbo.OtherTable works just fine). How can I avoid the error and

The Transaction Ended In The Trigger The Batch Has Been Aborted

你说的曾经没有我的故事 提交于 2019-12-01 02:20:54
问题 I am using Sql Server 2008 . I have a Trigger which updates my two other tables. I have read the Stack over flow this link enter link description here, but it does not full fill my needs. Below is my Trigger ALTER TRIGGER [Inventory].[StockUpdationOnIssue] ON [Inventory].[StockIssueDetails] AFTER INSERT AS BEGIN BEGIN TRY BEGIN TRAN INSERT INTO TableA (col1, col2,col3 ) SELECT I.col1,I.col2,si.col3 FROM inserted I INNER JOIN Inventory.StockIssue SI ON SI.StockIssueId = I.StockIssueId INSERT

I am unable to use THROW SQL Server 2008 R2

不羁岁月 提交于 2019-12-01 02:15:33
SQL Server 2008 R2 Management Studio does not recognized my throw in the below example, it says incorrect syntax near Throw I am trying to throw an error here, so I can handled it in my website when someone insert the same value twice. Begin Try insert into BusinessID (BusinessID) values (@ID) insert into BusinessID (BusinessID) values (@ID) End Try Begin Catch Print 'PK already exist' THROW End Catch THROW Statement is introduced in SQL Server 2012 http://msdn.microsoft.com/en-us/library/ee677615.aspx You can use RAISERROR instead. http://msdn.microsoft.com/en-us/library/483588bd-021b-4eae

what is Enlist=false means in connection string for sql server?

允我心安 提交于 2019-12-01 02:00:16
问题 I am a beginner with .net. I faced issue with the following error "The transaction operation cannot be performed because there are pending requests working on this transaction.". i read somewhere in the blog .i appended my connection string with enlist=true and the issue was resolved. Note : i am upgrading my DB from sql server 2005 to sql server 2008R2. Please help to understand the importance of using enlist. 回答1: Enlisting is user for Distributed Transaction The Connection object will