sql-server-2014

Open SQL Server 2012 From Command Prompt

情到浓时终转凉″ 提交于 2019-12-08 07:56:37
问题 I have installed SQL Server 2012, SQL Server 2008 R2 and SQL Server 2014. Now when I run SSMS it always opens SQL Server 2008. What to do same for SQL Server 2012? Any shortcut key or command to run from command prompt like SSMS ? Please guide me. 回答1: I found the solution. It is so simple. Just create desktop short cut and copy that file to C:\Windows\ For example: Create short cut named as on desktop SQL Server Management Studio Now simply copy it to your C:\Windows path and rename it to

dropping an index speeds up query: why?

妖精的绣舞 提交于 2019-12-08 05:23:27
问题 By trial and error, i found that an index on a table on my DB was drastically affecting the performance of a query. With index: execution time 30sec Without index: execution time <1sec It is the first time I see something similar, anyway the index makes sense since it is a non-unique non-clustered index on a Foreign key. The table is the same I describe in this post (thanks to which I was able to create the FK). The next step was creating the index: CREATE NONCLUSTERED INDEX [IX_RDATA_COMBO

SQL Server 2014 Service Broker does not activate the procedure that receives messages from the queue

狂风中的少年 提交于 2019-12-08 03:08:00
问题 The situation is closely related to SQL Service Broker - communication scenario - migration from SQL 2008 R2 to SQL 2014 and to SQL Service Broker -- one central SQL and more satelite SQL... beginner wants to understand details. After migration from SQL Server 2008 R2 Standard Ed. to SQL Server 2014 Standard Ed., the same code does not work. The firewall was set to allow the communication. The sys.transmission_queue (on both sender and receiver servers) keeps empty, and the GenericQueue (my

Counting Values based on distinct values from another Column

↘锁芯ラ 提交于 2019-12-08 01:20:23
问题 I need to calculate how many orderlines there are based on the orderlineNo being distinct. Each OrderNo is different BUT the OrderLineNo is the same for each order. i.e. 9 lines on a order then order lines number will go from 1 - 9. The same if on another order there are 3 orderlines they will go from 1 - 3 But in orderlineno there could be orderline numbers that are the same - for this I only want to count it once Example: OrderNo OrderLineNo 987654 1 987654 2 987654 2 987654 3 987654 4

How to distinguish between day and night shifts by looking at past sign in times?

安稳与你 提交于 2019-12-07 18:04:43
问题 Currently, the report uses predefined times. But sometimes employees overstay their shift and they creep into the next shift report. How do I modify the report query to look at the past sign in times to avoid this? In the TIMEATT column 1 is entry and 2 is exit. Light blue highlights the correct entries and yellow signify incorrect entries. Day shift report for 29th has 'Done, Jane's' entry time from night shift Night shift report for 29th has 'Do, Jone's' entry time from day shift Below

dropping an index speeds up query: why?

ⅰ亾dé卋堺 提交于 2019-12-07 17:55:29
By trial and error, i found that an index on a table on my DB was drastically affecting the performance of a query. With index: execution time 30sec Without index: execution time <1sec It is the first time I see something similar, anyway the index makes sense since it is a non-unique non-clustered index on a Foreign key. The table is the same I describe in this post (thanks to which I was able to create the FK). The next step was creating the index: CREATE NONCLUSTERED INDEX [IX_RDATA_COMBO_VALUES] ON [dbo].[RDATA_COMBO_VALUES] ( [ID_REFERENCES] ASC )WITH (PAD_INDEX = OFF, STATISTICS

Execute SSIS package from stored procedure as proxy user without xp_cmdshell

 ̄綄美尐妖づ 提交于 2019-12-07 13:33:49
问题 I am trying to run an SSIS package through a stored procedure, but I am getting an Access is denied error when I try to import a CSV. I put the package inside a job and ran it and it worked as long as I used a proxy account. I am trying to replicate that proxy account to the stored procedure call without using xp_cmdshell . I also ran this package inside Visual Studio and it ran smoothly. My SSIS package is simple: It imports a CSV file from the network, converts the data to varchar , and

how to migrate or copy SSRS datasource from one server to another without restoring the report server

半世苍凉 提交于 2019-12-07 13:13:15
问题 I'm trying to migrate SSRS report from SQL 2008r2 to SQL 2014 server. I used reportsync to transfer the report to the server. the reports are successfully transferred but however the roles subscriptions and datasources are not transferred. Is there is any way to copy or migrate the data sources, roles and subscription from one server to another without restoring the report server database?. Thanks. 回答1: I have used these migration tools which doesn't help me much. i found the below link after

Bulk insert from CSV file - skip duplicates

牧云@^-^@ 提交于 2019-12-07 13:04:47
问题 UPDATE: Ended up using this method created by Johnny Bubriski and then modified it a bit to skip duplicates. Works like a charm and is apparently quite fast. Link: http://johnnycode.com/2013/08/19/using-c-sharp-sqlbulkcopy-to-import-csv-data-sql-server/ I have been searching for an answer to this but cannot seem to find it. I am doing a T-SQL bulk insert to load data into a table in a local database from a csv file. My statement looks like this: BULK INSERT Orders FROM 'csvfile.csv' WITH

Sorting month name in dynamic pivot

浪子不回头ぞ 提交于 2019-12-07 11:43:24
问题 I produced a dynamic pivot with the following query which work but the column (monthyear) are in alphabetical order but I want them in chronological order The monthyear column is derived using a function in SQL Server 2014 CREATE TABLE ##MyTable (Num VARCHAR(10), StartDate DATE, [Types] VARCHAR(10)) INSERT INTO ##MyTable VALUES ('AA1','2016-01-01', 'Type1'),('AA2','2017-01-04', 'Type1'),('AA3','2016-01-04', 'Type1'),('AA4','2017-01-01', 'Type2'), ('AA5','2017-01-10', 'Type3'),('AA6','2016-01