sql-server-2014

Response data truncation when running SP through job

点点圈 提交于 2019-12-10 11:46:13
问题 Subject: I've got a report that I create every month. The creation of report consists of 2 steps: Get an XML from our service and store it in DB; Parse XML and create file. For the last few month I've created report in manual mode. And now I want to automate this stuff. But here comes a Problem: The second step (parsing XML and file creation) runs like a charm, but with first step I'm observing weird behaviour. I got Stored Procedure which gets XML: ALTER PROCEDURE [Structure].[GetXML]

Populate the number ranges & concatenate with text in the child table

心已入冬 提交于 2019-12-10 09:32:09
问题 Wondering how to build a logic for the below scenario (I am using SQL Server 2008 & above). In TblMaster each record will have a Start value and an End value. Along with that a CharToAdd varchar column as well. If the range says 1 to 3 then in the TblDetails there should be an entry for 1,2,3. Not sure whether I am explaining it effectively so have provided a screenshot with sample input/output as well. Ranges would be anywhere between 5000 to 100000 (max) so performance is a concern as well.

How to fix error “SQL Server Agent stopped automatically”?

社会主义新天地 提交于 2019-12-10 02:43:27
问题 I'm using SQL Server 2014 and having a problem. In Task Manager , on Services tab, I found SQLAgent$VILLBE_SQLSERVER (VILLBE is my computer name), right click and Start. It started and... stopped after 1 second. Then, I open services.msc , and Start the SQL Server Agent (VILLBE_SQLSERVER) . It's working. After 30 seconds, it stopped automatically. When I click Start again, it said that: The SQL Server Agent (VILLBE_SQLSERVER) service on Local Computer started and then stopped. Some services

Incorrect syntax near OFFSET command

喜夏-厌秋 提交于 2019-12-08 19:28:24
问题 Why this doesn't work and gives me a "Incorrect syntax near offset command" error SELECT o.orderdate, o.orderid, o.empid, o.custid FROM Sales.Orders o ORDER BY o.orderdate, o.orderid OFFSET 50 ROWS FETCH NEXT 25 ROWS ONLY; I am using SQL Server Express 2014 回答1: Check the database compatibility level. OFFSET was added in SQL Server 2012, so if your database is in 2008 compatibility mode, this keyword is not available. View or Change the Compatibility Level of a Database In T-SQL you can check

SSIS Stored Procedure uses Temp Table 2008 and 2014

旧城冷巷雨未停 提交于 2019-12-08 16:02:24
问题 I'm currently writing an SSIS package that retrieves data from a stored procedure via an OLE DB Source. The stored procedure contains a rather nasty query that I've been able to improve with the use of temp tables. If I switch these temp tables to table variables, the logical reads jump from about 1.3 million to about 56 million. I'm uncomfortable enough with the 1.3 million, but there is no way that I can be satisfied with the 56 million logical reads. Thus, I can't really convert the temp

Exception: System.InvalidOperationException Trying to validate a login information

与世无争的帅哥 提交于 2019-12-08 13:13:09
问题 I am trying to create a login Form. But Having Problems with database. I have created a windows form which consists of a user name and password, and a login button. But I think statement : DataAdapterObject.Fill(DataTableObject) has some error. I am using Visual Studio Profesional 2013 Update 4 and Sql Server 2014 Enterprise Editon. The Code is as follows : using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System

How to generate minute intervals between two dates in T-SQL?

一世执手 提交于 2019-12-08 12:13:23
问题 I have a table of startTime and endTimes. I need to generate a table of intervals between those two dates in minutes. Here's some sample data: declare @intervalMinutes int = 10 declare @myDates table ( myId int primary key identity, startTime datetime, endTime datetime ) insert @myDates (startTime, EndTime) values ('2016-07-10 08:00','2016-07-10 09:00') insert @myDates (startTime, EndTime) values ('2016-07-12 10:00','2016-07-12 12:00') insert @myDates (startTime, EndTime) values ('2016-07-14

Running Total until specific condition is true

我只是一个虾纸丫 提交于 2019-12-08 10:32:20
问题 I'm having a table representing the dealers cards and their rank. I'm now trying to make a query (as fast as possible) to set status on the game. (As said before, only the dealer cards is shown) W = Win S = Stand L = Loss B = Blackjack (in two cards) About the rules: The dealer wins at 21, if it's in two cards its blackjack. If the rank is between 17 and 20 it's S = stand. Over 21 is a loss. Ranks: 1 (ACE) - 1 or 11 rank. Counted as 11. 2-10 - 2-10 rank 11-13 (knight - king) - 10 rank ╔════╦═

Handling objects being different for different SQL Server Versions

安稳与你 提交于 2019-12-08 08:46:26
I have created a new database project in Visual Studio and have been adding my pre-existing objects to it. This is a database that we'll be deploying to multiple different servers with at least two different versions of sql server. I have a view that looks at availability groups and pulls the Is_Distributed column if the server is 2016. I need a way in this project to essentially save both versions, the 2014 and 2016, and be able to potentially deploy the correct version depending on what server i'm deploying to. Is this possible to do in a Database Project in Visual Studios? One solution

Handling objects being different for different SQL Server Versions

左心房为你撑大大i 提交于 2019-12-08 08:37:02
问题 I have created a new database project in Visual Studio and have been adding my pre-existing objects to it. This is a database that we'll be deploying to multiple different servers with at least two different versions of sql server. I have a view that looks at availability groups and pulls the Is_Distributed column if the server is 2016. I need a way in this project to essentially save both versions, the 2014 and 2016, and be able to potentially deploy the correct version depending on what