sql-server-2008-r2

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

我只是一个虾纸丫 提交于 2019-12-10 03:54:31
问题 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 '

Can I create SSRS Reports in VS 2015 using SQL Server 2008 R2?

喜夏-厌秋 提交于 2019-12-10 03:45:55
问题 I'm new to SSRS. Recently upgraded my development environment from Visual Studio 2010 to Visual Studio 2015 Enterprise Edition. Currently my reports are made using Crystal Reports. I would like to to use SSRS and I'm trying find out my current environment will allow me to do it. So now I'm using Visual Studio 2015 and SQL Server 2008 R2. Can I create SSRS Reports using these two? If yes, how can I create it? I know how to create a report and publish it using the Business Intelligence

Delete Every Alternate Row in SQL

血红的双手。 提交于 2019-12-10 03:12:31
问题 I need to clean up a table which has three columns, ID (uniqueidentifier), Observation (nvarchar), and Timestamp (datetimeoffset). The content is generated by two sensors at 1 hour interval, and the value of Observation is the same from the two sensors. My idea is to do a SELECT query such as SELECT * FROM [Records] ORDER BY [Timestamp] and then delete every alternate row. I found this on SO how to delete every alternate row in access table, but doesn't really applies here as the ID is not

Create user that can only SEE one database, and only select from it?

喜欢而已 提交于 2019-12-10 03:11:00
问题 We have several databases on SQL server. We would like to create 1 new user that can see database 'c' but can not see the rest of the databases. This user should only be able to select from this database, and nothing else. I have been googleing and searching for a while now, and the closest I found was to deny view any database, and then make them the database owner. But I don't think that will work for limiting them to select, unless is there a way I can deny everything except for select on

SQL Server drop and recreate indexes of a table

一世执手 提交于 2019-12-10 03:00:50
问题 I have a situation in my SQL Server 2008. I need to change a column type, but the indexes are preventing the changes. But because of the database is on several clients, I don't know how many indexes exists involving the column. Is there any way of getting, programmatically speaking, all indexes that involve the column and drop them, and after the alter table statement recreate them automatically? I've heard that disabling them can mess with the table because of the change of type. I'm

Does SqlConnection processes queries in parallel?

和自甴很熟 提交于 2019-12-09 16:28:27
问题 If I open a SqlConnection to a SQL Server, and then issue multiple queries from multiple background threads, all using that one connection - will those queries be executed sequentially (don't care about the order)? Specifically, if at the beginning of one query I change isolation level and then restore it at the end of that query - is there a chance that this isolation level may apply to other queries? I think not, but want to confirm. SQL Server 2008 R2 And I am talking about System.Data

Drop all extended properties on SQL Server

妖精的绣舞 提交于 2019-12-09 15:39:38
问题 How to drop all extended properties on SQL Server in a scriptable way? 回答1: If you want a script that will drop all extended properties in one go then use a script that Jamie Thomson has created that will generate drops for all extended properties. You can download it from this article. I've pasted his script here (in full with acknowledgements in-case the article is removed): /* This script will generate calls to sp_dropextendedproperty for every extended property that exists in your

Select subset of rows using Row_Number()

浪子不回头ぞ 提交于 2019-12-09 13:33:01
问题 Select id, name, ROW_NUMBER() OVER (ORDER BY id asc) as 'RowNo' from customers where RowNo between 50 AND 60 I am trying to select a subset of rows between 50 and 60 . The problem is 'RowNo' is an invalid column name. Thank you Using SQL SERVER 2008 R2 回答1: Use your query as subquery like bellow: select * from ( Select id, name, ROW_NUMBER() OVER (ORDER BY id asc) as [RowNo] from customers ) t where RowNo between 50 AND 60 You can use CTE as well but whether to choose one over another read

How to get SQLCMD to output errors and warnings only

狂风中的少年 提交于 2019-12-09 09:30:28
问题 How can you get SQLCMD, when executing a SQL script file, to just output any errors or warnings it encounters? I essentially dont want information based messages to be output. 回答1: It's not possible to prevent SQLCMD returning non-error output messages by passing it a parameter. However, what you can do is redirect error messages to STDERR , then direct all other messages to NUL . This is done by passing the -r parameter. From books online: -r[ 0 | 1] msgs to stderr Redirects the error

ALTER INDEX failed because of QUOTED_IDENTIFIER when running from sp_msForEachTable

天大地大妈咪最大 提交于 2019-12-09 09:28:47
问题 When I try to rebuild an index on a table: ALTER INDEX ALL ON [dbo].[Allocations] REBUILD that works fine. But when I call EXECUTE sp_msForEachTable 'ALTER INDEX ALL ON ? REBUILD' I reach the same same table, and it fails with: Msg 1934, Level 16, State 1, Line 2 ALTER INDEX failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query