sql-server-2008-r2

Collation Error

僤鯓⒐⒋嵵緔 提交于 2020-08-21 04:35:12
问题 I am using Microsoft SQL Server Management Studio. I have two databases one is the system database, which has the master database and the other one is my database called CCTNS_CAS_DE_DB . When I am trying to generate the reports through the tool which uses the CCTNS_CAS_DE_DB database. I get the following error: Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation I went through the SQL Server and checked the

Impersonation in SQL Server Views?

有些话、适合烂在心里 提交于 2020-08-07 06:07:51
问题 Is it possible to create views with impersonation, similar to "execute as" in stored procedures? I would like to create some views in a separate schema. Some users should get SELECT and UPDATE access to these views, so that they are able to change the underlying tables, but without having direct update access to the table. Is that possible with a view ? 回答1: No, this is not possible. EXECUTE AS is mainly used with SP's, but you can use them a bit more widely. From TechNet: In SQL Server you

Impersonation in SQL Server Views?

假如想象 提交于 2020-08-07 06:07:31
问题 Is it possible to create views with impersonation, similar to "execute as" in stored procedures? I would like to create some views in a separate schema. Some users should get SELECT and UPDATE access to these views, so that they are able to change the underlying tables, but without having direct update access to the table. Is that possible with a view ? 回答1: No, this is not possible. EXECUTE AS is mainly used with SP's, but you can use them a bit more widely. From TechNet: In SQL Server you

dbHasCompleted always returns TRUE

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-13 06:19:29
问题 I'm using R to do a statistical analysis on a SQL Server 2008 R2 database. My database client (aka driver) is JDBC and thereby I'm using RJDBC package. My query is pretty simple and I'm sure that query would return a lot of rows (about 2 million rows). SELECT * FROM [maindb].[dbo].[users] My R script is as follows. library(RJDBC); javaPackageName <- "com.microsoft.sqlserver.jdbc.SQLServerDriver"; clientJarFile <- "/home/abforce/mystuff/sqljdbc_3.0/enu/sqljdbc4.jar"; driver <- JDBC

CTE (Common Table Expression) vs Temp tables or Table variables, which is faster?

天涯浪子 提交于 2020-06-10 02:51:28
问题 CTE (Common Table Expression) vs Temp tables or Table variables , which is faster? 回答1: We got a 50% increase in speed moving to CTE in one particular case so it's worth giving it a go but any performance related enhancements need to be bench marked so you can compare one against another. PS: we wrote more than one query with a CTE in it before we got the one we now use. 回答2: As I already said in my comment: IT DEPENDS! It really does depend on your query, your data (how much is there? What

SQL Server “.” Alias Not Working

穿精又带淫゛_ 提交于 2020-05-10 07:29:53
问题 I've added an alias of "." which should point to my local (named) instance, ".\SQL2008". But when I try to connect to ".", it times out. Am I missing something or is this not allowed? Aliases I've tried which do not work: (Set for both 32 and 64-bit, I've also tried leaving the port blank.) 回答1: If you are creating TCP/IP aliases you need to ensure the "SQL Server Browser" service is running. As well as checking the TCP/IP protocol is enabled for both server and client. In Sql Server

How to use ROW_NUMBER() in UPDATE clause? [duplicate]

笑着哭i 提交于 2020-04-10 06:47:05
问题 This question already has answers here : SQL Update with row_number() (8 answers) Closed 4 years ago . ROW_NUMBER() is only for used in the SELECT clause in MS SQL Server , but I want to use it for update like the following: Update MyTab Set MyNo = 123 + ROW_NUMBER() over (Order By ID) Where a=b; then I got Error like, Windowed functions can only appear in the SELECT or ORDER BY clauses. How to use ROW_NUMBER() in UPDATE clause? 回答1: DECLARE @MyTable TABLE ( ID INT IDENTITY(2,2) PRIMARY KEY,

Rebuild all indexes in a Database

廉价感情. 提交于 2020-04-07 10:58:12
问题 I have a very large SQL Server 2008 R2 database (1.5TB) and will be copying some data from column to column within the same table. I've been told that the schema has a large number of indexes and was wondering if there is a default query or script that will rebuild all the indexes. Have also been advised to update the statistics at the same time? Each of the 30 tables has one clustered index and 13x non-clustered indexes Thanks. 回答1: Try the following script: Exec sp_msforeachtable 'SET

Blank out duplicate column values in SQL Reporting Services

拈花ヽ惹草 提交于 2020-04-04 06:48:09
问题 This has to be stupid easy to do, but I'm not seeing it. I have a SQL Reporting Services (SQL 1008 R2) report. I'm using a tablix to basically show: COL 1 | COL 2 | COL 3 | COL 4 ---------------------------------- 100 | 100 | 100 | Item 1 100 | 100 | 101 | Item 2 100 | 100 | 102 | Item 3 100 | 110 | 110 | Item 4 100 | 110 | 110 | Item 4 100 | 110 | 111 | Item 5 100 | 110 | 112 | Item 6 But I want to suppress repeating values in those first two columns so it looks like this: COL 1 | COL 2 |

Can a SSIS 2012 package be deployed to SQL Server 2008 R2?

天涯浪子 提交于 2020-03-09 05:24:49
问题 I built a SSIS package in VS2013 and can't find any deployment instructions. One person mentioned he thought you can't deploy backwards. So before I rebuild the package in BIDS 2008, I want to make sure there is no way to deploy. 回答1: Pretty much none of the MS BI stack (SSIS, SSRS, SSAS) is backward compatible, meaning you cannot develop in a newer environment and deploy to an older SQL Server. And if you think about it, it's easy to understand why: SSIS packages, SSRS Reports, and SSAS