sql-server-2012

Error while installing SQL Server 2012 Standard Edition

拟墨画扇 提交于 2019-12-22 11:23:34
问题 Here's how the error looks while the installation: An error occurred during the setup process of the feature Attempted to perform an unauthorized operation. Clicking on Retry doesn't help, if I click on the Cancel button, it continues but then there will come up more errors like this one: NOTE: I'm not using any VM, I'm using Windows 7 Ultimate 32 bit as my OS. Here's the log details: Overall summary: Final result: Failed: see details below Exit code (Decimal): -2068119551 Start time: 2013-10

SSAS Dimension attribute as Calculated Measure

浪子不回头ぞ 提交于 2019-12-22 10:44:28
问题 I am having some issues trying to implement an average of a dimension attribute. The basic structure is: Booking Header Dimension Fact Table (multiple rows per Booking Header entry) On the booking header dimension I have a numerical attribute called Booking Window, and I want to be able to create a calculated measure that averages this value. We are using SQL Server 2012 standard edition. Any help would be greatly appreciated. 回答1: The best approach would be to create a measure group from the

Application cannot open SQL connection when on IIS

跟風遠走 提交于 2019-12-22 10:38:55
问题 I have a connection string that looks like this: Server=.;Database=mydbname;Trusted_Connection=True; This works fine when i run/debug my application using Visual Studio (IIS Express) but after deployment over IIS-8 it throws me an exception while opening connection that: Login failed for user 'IIS APPPOOL\mysite'. I am very confused why this is happening why IIS is adding its user in the middle when the database doesnt require one and why this is not happening with IIS Express ? 回答1: You're

Sql concatenate of row data into column

◇◆丶佛笑我妖孽 提交于 2019-12-22 10:19:39
问题 Data set: +-----------------+--------+---------+ | TransNo | Serial | Project | +-----------------+--------+---------+ | A00000000000001 | 1 | 100 | | A00000000000001 | 2 | 200 | | A00000000000001 | 3 | 201 | | A00000000000001 | 4 | 101 | | A00000000000002 | 1 | 100 | | A00000000000002 | 2 | 101 | | A00000000000003 | 1 | 100 | | A00000000000003 | 2 | 200 | | A00000000000004 | 1 | 200 | | A00000000000004 | 2 | 100 | | A00000000000005 | 1 | 101 | | A00000000000005 | 2 | 100 | +-----------------

Ignore duplicate records in SSIS' OLE DB destination

微笑、不失礼 提交于 2019-12-22 10:01:18
问题 I'm using a OLE DB Destination to populate a table with value from a webservice. The package will be scheduled to run in the early AM for the prior day's activity. However, if this fails, the package can be executed manually. My concern is if the operator chooses a date range that over-laps existing data, the whole package will fail (verified). I would like it: INSERT the missing values (works as expected if no duplicates) ignore the duplicates; not cause the package to fail; raise an

Get previous row updated value using LAG Without using Recursive CTE

我怕爱的太早我们不能终老 提交于 2019-12-22 10:00:09
问题 How to use LAG function to get the updated previous row value (without using Recursive CTE ). Please check the screenshot for sample output Query Tried Declare @Tbl as Table(SNO Int,Credit Money,Debit Money,PaidDate Date) Insert into @Tbl SELECT * FROM (VALUES (1,0,12,'7Jan16'), (2,10,0,'6Jan16'), (3,15,0,'5Jan16'), (4,0,5,'4Jan16'), (5,0,3,'3Jan16'), (6,0,2,'2Jan16'), (7,20,0,'1Jan16')) AS X(SNO,Credit,Debit,PaidDate) Select T.SNO, T.Credit, T.Debit, TotalDebit = Case When Credit < LAG(T

Recursive CTE to find all ancestors OF ALL ITEMS

北城余情 提交于 2019-12-22 09:15:07
问题 I have a simple hierarchy and need to be able to generate a single table that matches EACH item in the table with ALL of its ancestors. (Caps to emphasize that this is not a duplicate question!) So here's a table: Select Item='A', Parent=null into Items union Select Item='B', Parent='A' union Select Item='C', Parent='A' union Select Item='D', Parent='B' union Select Item='E', Parent='B' union Select Item='F', Parent='C' union Select Item='G', Parent='C' union Select Item='H', Parent='D' Go ..

Return error message from stored procedure

て烟熏妆下的殇ゞ 提交于 2019-12-22 08:52:58
问题 The question should be quite simple, but I can't figure out the answer nor why my stored procedure is not working. CREATE PROCEDURE spTest_Delete @ID int AS begin tran declare @err int declare @errMesage nvarchar(max) set @errMesage = '' set @err = 0 delete from Test where ID = @ID set @err = @@ERROR set @errMesage = ERROR_MESSAGE() if @err = 0 commit tran else begin RAISERROR(N'Could not delete !Error nr: %d. Message: %s', 1, 16, @err, @errMesage) rollback tran end This procedure runs ok,

updating multiple columns using case statement in sql server

a 夏天 提交于 2019-12-22 08:47:01
问题 I would like to update the table using case statement the query is like this... select case(@columnname) when 'name1' then begin update table set pay1=pay1* 100 pay2=pay2*20 pay3=pay3* 100 end when 'name2' then begin update table set pay2=pay2*20 pay3=pay3* 100 end when 'name3' then begin update table set pay3=pay3* 100 end end can u please tell the correct logic to complete the query using case statement 回答1: You'll have to swap the syntax around. The case statement will be applied for every

Islands and Gaps Issue

安稳与你 提交于 2019-12-22 08:44:43
问题 Backstory: I have a database that has data points of drivers in trucks which also contain the. While in a truck, the driver can have a 'driverstatus'. What I'd like to do is group these statuses by driver, truck. As of now, I've tried using LAG/LEAD to help. The reason for this is so I can tell when a driverstatus change occurs, and then I can mark that row as having the last datetime of that status. That in itself is insufficient, because I need to group the statuses by their status and date