sql-server-2014

SqlCommandBuilder() creates insert/update for underlying tables instead for a view

亡梦爱人 提交于 2019-12-31 01:57:09
问题 I have two schemas, like this: Schema 'data' --> holds tables, and nobody has access to them from outside Schema 'ui' --> holds views which are accessibly from outside; the idea is that you can select/delete/update/insert on these views. Thus, I am doing ownership chaining. For example: create table data.tblTest (TestKey int not null primary key); create view ui.vwTest as select * from data.tblTest; Now, if I connect as a user with SQL Studio, everything is OK: select * from ui.vwTest; --

SQL Server Data Tools 2015 installation error

↘锁芯ラ 提交于 2019-12-30 06:25:29
问题 I'm trying to install SQL Server Data Tools - Visual Studio 2015, but I keep getting an "Unspecified error". The log file is at https://drive.google.com/open?id=0B3CEKzS2Sw8OODNJOXZJVGRWQlU. I already have Visual Studio Professional 2015 installed. I want to install SSDT 2015 because my databases were recently migrated from SQL Server 2008 R2 to 2014, and I need to use SSIS. Previously, I used SQL Server Business Intelligence Development Studio to create my DTS packages, which I still have

SQL Server Data Tools 2015 installation error

吃可爱长大的小学妹 提交于 2019-12-30 06:25:18
问题 I'm trying to install SQL Server Data Tools - Visual Studio 2015, but I keep getting an "Unspecified error". The log file is at https://drive.google.com/open?id=0B3CEKzS2Sw8OODNJOXZJVGRWQlU. I already have Visual Studio Professional 2015 installed. I want to install SSDT 2015 because my databases were recently migrated from SQL Server 2008 R2 to 2014, and I need to use SSIS. Previously, I used SQL Server Business Intelligence Development Studio to create my DTS packages, which I still have

How to store longitude & latitude as a geography in sql server 2014?

不羁的心 提交于 2019-12-30 03:58:12
问题 I'm a sql beginner that knows how to get my users location in longitude and latitude coordinates. My goal is eventually to be able to select all rows from myTable Where distance is less than 2km. However on my way towards this goal there is some things that confuses me so I'll try to list what I'm failing to understand. How can i use the longitude and latitude to store location within a geography column?(because it's supposed to be only one geographic point not two right? not one for

Insert and update in a cursor in SQL Server

若如初见. 提交于 2019-12-29 09:34:40
问题 I have a Table shown below DateRange 10/1 11/1 12/1 I am looping through this table using cursor and trying to populate a temp table Create table #BidStatusCalculation1 ( Code nvarchar(max), Data int ) Declare @monthStart varchar(20) DECLARE cur CURSOR FOR SELECT DateRange FROM @dateRange OPEN cur FETCH NEXT FROM cur INTO @monthStart WHILE @@FETCH_STATUS = 0 BEGIN Insert into #BidStatusCalculation1 select 'SL Payroll',Count(*) from DashboardData where DataType = 'Bid' and CONVERT(NVARCHAR,

How to add date range for the same day? How to call function to convert seconds to hh:mm:ss

前提是你 提交于 2019-12-25 08:59:26
问题 I'm writing code on SQL Server 2014 to pull records for a single day. I will then be using Report Builder to create the report. I'm not sure if my code is right. The times of the shifts are in 'yyyy-mm-dd hh:mm:sss' format starting at 7:45am to 6:15pm. I need to count total calls (and other fields) for that time period per day. I will also need to give a parameter so the viewer can select the date range for the report. I created a function to convert total seconds to HH:MM:SS format. The code

SQL Loop through all tables and get the max value from a specific column

浪子不回头ぞ 提交于 2019-12-25 07:59:15
问题 I'm trying to create an audit table that checks the loaded date for that table. Basically, I want to loop through all tables in the database and check for a specific column - LoadedDate and return the max value for that column for each table SELECT TABLE_NAME INTO #TableList FROM INFORMATION_SCHEMA.COLUMNS WHERE column_name = 'LoadedDate' SELECT MAX(LoadedDate) FROM @TableName -- I guess using a cursor to loop through #TableList in to a results table TableName LoadedDate Table 1 2016-06-01

SQL Server 2014 error on updating the service pack

蓝咒 提交于 2019-12-25 07:46:32
问题 I was using SQL Server 2014, and due to an error while adding a certificate in MMC, I have was told to update SQL Server. Please see my link of post on MMC: (MMC crash in windows 10) Now I am getting the following error. Can anyone advice me the further steps to proceed? 来源: https://stackoverflow.com/questions/43703500/sql-server-2014-error-on-updating-the-service-pack

how to count common nodes between two nodes in sql

南楼画角 提交于 2019-12-25 04:28:21
问题 How to count common nodes between two nodes in sql for this example: count <li> tags between <h2 id="vgn">VGN A </h2> and <h2 id="vgn">VGN </h2> and the number of <h2> tags. In other words: count of li between h2 number1 and h2 number 2 in this example. <table class="table table-condensed table-no-border table-brand-main"> <tr><td><h2 id="vgn">VGN A </h2></td></tr> <tr><td> <style> ul.brand_572 { -moz-column-count: 6; -webkit-column-count: 6; column-count: 6; } ul.brand_572 li { width:120px;

Bulk insert, Cannot bulk load. Unknown version of format file

跟風遠走 提交于 2019-12-24 22:19:49
问题 I'm having problems importing data exported using a more recent version of the bcp utility. I need my exported data to be compatible with SQL server 2012. It is my understanding that I need to add the -V110 option when exporting data. However, even if I add the -V110 to the bcp command I always get version 12.0 (which is my bcp version) on the FMT file. Here is a sample of my bcp call: bcp [DB].[dbo].[Table1] format nul -c -f "E:\TMP\DATA\Table1.FMT" -V110 -S [SERVER] -t , -T Does anybody