sql-server-2012

Installing SQL Server 2012 - Error: Prior Visual Studio 2010 instances requiring update

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 16:11:25
问题 I'm trying to install SQL Server 2012 Developer Edition and I can get to the point where it's doing the Installation Rule Checks but one of the rules keep failing: 'Prior Visual Studio 2010 instances requiring update' It basically indicates that I need to have VS2010 SP1 installed. However, I DO have VS2010 SP1 installed. I've tried reapplying the VS2010 SP1 and installing the VS2010 patches on the SQL Server 2012 media as well to no avail. Is anyone else seeing this issue? Have any ideas

How to query this output in SQL server

偶尔善良 提交于 2019-12-20 15:32:36
问题 I have a table with data like this: CREATE TABLE Test (CustName varchar(20), Country varchar(20), RecordedTime datetime, CurrNo tinyint); INSERT INTO Test (CustName, Country, RecordedTime, CurrNo) VALUES ('Alex', 'Australia', '2018-06-01 08:00:00', 1), ('Alex', 'China', '2018-06-01 10:00:00', 2), ('Alex', 'India', '2018-06-01 10:05:00', 3), ('Alex', 'Japan', '2018-06-01 11:00:00', 4), ('John', 'Australia', '2018-06-01 08:00:00', 1), ('John', 'China', '2018-06-02 08:00:00', 2), ('Bob',

Select all parents or children in same table relation SQL Server

孤街浪徒 提交于 2019-12-20 11:52:22
问题 SQL developers, I have a badly planned database as task to learn a lot about SQL Server 2012. SO, there is the table Elem : +-----------+----+---+----------+------------+ |VERSION(PK)|NAME|KEY|PARENT_KEY|DIST_KEY(FK)| +-----------+----+---+----------+------------+ |1 |a |12 |NULL |1 | +-----------+----+---+----------+------------+ |2 |b |13 |12 |1 | +-----------+----+---+----------+------------+ |3 |c |14 |13 |1 | +-----------+----+---+----------+------------+ |4 |d |15 |12 |1 | +-----------+

Query all table data and index compression

♀尐吖头ヾ 提交于 2019-12-20 10:29:14
问题 Does anyone happen to have a generic SQL statement that'll list all of the tables and indexes in a database, along with their current compression setting, for each partition? Thanks. EDIT: This is as far as I got in my attempt to query tables, but I'm not sure the join is correct (I'm getting duplicates, which seems to be caused by the presence of indexes) SELECT [t].[name], [p].[partition_number], [p].[data_compression_desc] FROM [sys].[partitions] AS [p] INNER JOIN sys.tables AS [t] ON [t].

Running Multiplication in T-SQL

大城市里の小女人 提交于 2019-12-20 10:10:32
问题 GTS Table CCP months QUART YEARS GTS ---- ------ ----- ----- --- CCP1 1 1 2015 5 CCP1 2 1 2015 6 CCP1 3 1 2015 7 CCP1 4 2 2015 4 CCP1 5 2 2015 2 CCP1 6 2 2015 2 CCP1 7 3 2015 3 CCP1 8 3 2015 2 CCP1 9 3 2015 1 CCP1 10 4 2015 2 CCP1 11 4 2015 3 CCP1 12 4 2015 4 CCP1 1 1 2016 8 CCP1 2 1 2016 1 CCP1 3 1 2016 3 Baseline table CCP BASELINE YEARS QUART ---- -------- ----- ----- CCP1 5 2015 1 Expected result CCP months QUART YEARS GTS result ---- ------ ----- ----- --- ------ CCP1 1 1 2015 5 25 -- 5

Backup a database on a HDD with a different sector size

蓝咒 提交于 2019-12-20 09:49:41
问题 In our development environment we have long been using a particular backup and restore script for each of our products through various SQL Server versions and different environment configurations with no issues. Recently we have upgraded to SQL Server 2012 as our standard development server with SQL Compatibility Level 2005 (90) to maintain support with legacy systems. Now we find that on one particular dev's machine we get the following error when attempting to backup the database: Cannot

Correct way to select from two tables in SQL Server with no common field to join on

余生颓废 提交于 2019-12-20 09:47:28
问题 Back in the old days, I used to write select statements like this: SELECT table1.columnA, table2.columnA FROM table1, table2 WHERE table1.columnA = 'Some value' However I was told that having comma separated table names in the "FROM" clause is not ANSI92 compatible. There should always be a JOIN statement. This leads to my problem.... I want to do a comparison of data between two tables but there is no common field in both tables with which to create a join. If I use the 'legacy' method of

ANSI_NULLS and QUOTED_IDENTIFIER killed things. What are they for?

旧城冷巷雨未停 提交于 2019-12-20 08:59:33
问题 NOTE: I checked Understanding QUOTED_IDENTIFIER and it does not answer my question. I got my DBAs to run an index I made on my Prod servers (they looked it over and approved it). It sped up my queries just like I wanted. However, I started getting errors like this: As a developer I have usually ignored these settings. And it has never mattered. (For 9+ years). Well, today it matters. I went and looked at one of the sprocs that are failing and it has this before the create for the sproc: SET

How can I clean up the SSISDB?

拟墨画扇 提交于 2019-12-20 08:57:53
问题 When I set this up I overlooked the retention period. My database has become pretty large so I want to decrease it's size. If I simply change the retention period (it was 365) it causes issues with SSIS running my packages. I even changed it in small increments but the deletion statement would create locks which would prevent new jobs from running. Any ideas how to work around this? I've thought about just creating a new SSISDB. 回答1: Phil Brammer ran into this and a host of other things

Linq to SQL / filter duplicates

天涯浪子 提交于 2019-12-20 07:39:37
问题 i have a view in my sql server 2012 with a couple of duplicates and i want to sort them by the newest and filter all others - can anyone help me? My viewin my SQL Server 2012: GUID (as primary key), number, datetime and name +-----+----------+--------------------------------+----- | guid | number| datetime | name +-----+----------+--------------------------------+------ | b105..| 1234567|2014-07-07T16:32:20.854+02:00:00|Name1 | s1b5..| 1111222|2014-07-06T16:30:21.854+02:00:00|Name2 | b17a..|