sql-server-2008-r2

SQL Server bug or feature? Decimal numbers conversion

喜欢而已 提交于 2019-12-05 10:00:41
问题 During development faced up with quite a strange SQL Server behavior. Here we have absolutely the same formula for absolutely the same number. The only difference is how we are getting this number (4.250). From table, temp table, variable table or hardcoded value. Rounding and casting is absolutely the same in all cases. -- normal table CREATE TABLE [dbo].[value] ( [val] [decimal] (5, 3) NOT NULL ) INSERT INTO [value] VALUES (4.250 ) SELECT ROUND(CAST(val * 0.01 / 12 AS DECIMAL(15, 9)), 9) AS

Why is SSDT Schema Compare showing difference in DefaultExpressionScript?

一世执手 提交于 2019-12-05 09:56:32
While comparing Database instance to a Database project in VS2010 using SSDT, it shows a difference in one of the Stored Procedures. The Store Procedure DDL script is exactly the same but when I expanded the Properties folder under the Store Procedure it show a difference in the DefaultExpressionScript. The source SP shows this in the DefaultExpresionScript: DefaultExpressionScript = at While the destination SP has this: DefaultExpressionScript = -1 I don't see where I can change this there is no such object called DefaultExpressionScript in my database project. where should I fix this? This

Spatial index slowing down query

非 Y 不嫁゛ 提交于 2019-12-05 09:36:14
Background I have a table that contains POLYGONS/MULTIPOLYGONS which represent customer territories: The table contains roughly 8,000 rows Approximately 90% of the polygons are circles The remainder of the polygons represent one or more states, provinces, or other geographic regions. The raw polygon data for these shapes was imported from US census data . The table has a spatial index and a clustered index on the primary key. No changes to the default SQL Server 2008 R2 settings were made. 16 cells per object, all levels medium. Here's a simplified query that will reproduce the issue that I'm

Arithmetic overflow error converting IDENTITY to data type tinyint

天涯浪子 提交于 2019-12-05 08:20:30
I am designing table in SQL Server 2008 R2 SP2 Express database. I created table with nvarchar column for data and tinyint column for auto-incrementing identity assuming there will be no more than few rows (that's why I choose 0-255 tinyint ). When I add more than 255 rows, this error keeps occurring permanently even after I delete all rows in that table and try to add one new row. I am doing this using SQL Server Management Studio Express. How to force database engine to check what indexes are free? Will this happen too if I change tinyint to int and reach limit of int number? Once you add

Slow “Select” Query with varchar(max)

时光怂恿深爱的人放手 提交于 2019-12-05 07:29:21
I have a small table with 500 rows. This table has 10 columns including one varchar(max) column. When I perform this query: SELECT TOP 36 * FROM MyTable WHERE (Column1 = Value1) It retrieves around 36 rows in 3 minutes. The varchar(max) columns contains in each row 3000 characters. If I try to retrieve only one row less: SELECT TOP 35 * FROM MyTable WHERE (Column1 = Value1) Then the query retrieves 35 rows in 0 seconds. In my clients statistics, Bytes received from server, I have: 95 292 for the query retrieving data in 0 sec over 200 000 000 for the query retrieving data in 3 min Do you know

Getting the error “Data retrieval failed for the subreport, 'Subreport1'” while trying to preview a report from Business Intelligence Studio

梦想与她 提交于 2019-12-05 07:25:35
I know this question has been asked before, but all questions were for reports being accessed using C# or vb.net code. My problem is that i am building and accessing the report using Business Intelligence studio, I am basically trying to add a sub report for a report, and I made sure from the parameters and they are ok. However when i try to access the report containing the subreport, I get the error "Data retrieval failed for the subreport, 'Subreport1'". I also tried deleting the .data files but the same problem persisted. I faced similar issue in past and in my case below were the culprit's

Generate script for triggers only using script wizard

若如初见. 提交于 2019-12-05 05:44:19
I have SQL Server 2008 R2. I have around 150 tables in a database and for each table I have recently created triggers. It is working fine in my local environment. Now I want to deploy them on my live environment. The question is I want to deploy only the triggers. I tried the Generate Script wizard but it is creating script with table schema along with triggers, NOT triggers only. Is there anyway to generate all the triggers drop and create type script? pkmiec Forget the wizard. I think you have to get your hands dirty with code. Script below prints all triggers code and stores it into table.

Deadlock issue in SQL Server 2008 R2 (.Net 2.0 Application)

喜你入骨 提交于 2019-12-05 05:35:19
The Sql Server 2008 R2 instance in question is a heavy load OLTP production server. The deadlock issue came up a few days back and is still unresolved. We received the Xml deadlock report that listed the stored procedures involved in the deadlock and some other details. I'll try to list down the facts from this xml first: Two stored procedures are involved in the deadlock, say SP1 and SP2. According to the report SP1 was running in Isolation level "Serializable" and SP2 was running in "ReadCommitted" . We have investigated the following: Are we setting IsolationLevel of SP1 to "Serializable"

Entity Framework 4.3.1 failing to create (/open) a database [Threading Anomaly?]

扶醉桌前 提交于 2019-12-05 05:12:57
I've used EF 4.1 ( Code First ) in an MVC 3 project a while back, and it was good. Today I tried using EF 4.3.1 ( Code First ) in a WinForms project and encountered some real voodoo: (The original project I was working on was WinForms, however the same thing is true for the attached Console Application code.) When trying to enter a simple class into the database, I get the following exception: Cannot open database "Test" requested by the login. The login failed. Login failed for user '[ComputerName]\[Administrator]'. I've tried checking the SQL Server (2008 R2) configurations but my user does

SSAS Tabular on Azure?

送分小仙女□ 提交于 2019-12-05 04:56:52
I'm attempting to deploy an ssas tabular model (I don't know what I'm doing ) I have made multidimensional on SQL Server 2008 R2 with VS2013. I wanted to try Tabular in conjunction with power BI. So I set up a SQL Azure DB, I have Azure SQL database and Visual Studio 2013 Pro I can get the connection to the Azure DB in VS2013 and write T-SQL against it but when I try and create a tabular model and select the Azure database as the SQL Server workspace it fails to make a connection. Is it something to do with the compatibility module or do I need to create a Azure VM? Thank you for your help ...