Performance issues using ASP.NET MVC5 (OrchardCMS 1.9.1) with SQL Server

Solution Solved this by doing some customization for the Navigations. Our navigation has hundreds of links that too using “ContentMenuItem”. The lazy lookup for each item and on top of that our custom view generation was making it hell slow. We took things to client side (using ajax requests) and only a very small footprint […]

Dynamic Insert Loop

As I understand it, the following code: declare @csvnmbr nvarchar(3) declare @sql nvarchar(400) set @csvnmbr = 1 set @sql = ‘BULK INSERT #tablename FROM ”C:\TEMP\’+@csvnmbr+’.csv” WITH (FIELDTERMINATOR = ”,”)’ while @csvnmbr < 4 begin print @sql set @csvnmbr = @csvnmbr + 1 end GO Should print: BULK INSERT #tablename FROM ‘C:\TEMP\1.csv’ WITH (FIELDTERMINATOR = ‘,’) […]

t-sql pivot tables with multiple columns and data types

I am trying to make a pivot table that pivots multiple columns of different data types, and I’m getting a bit confused. I currently have a table with one row for every student in every year of high school. Each row contains a lot of information about the student’s performance that year: GPA, credits accumulated, […]

SQL Procedure not showing xml data

I have simple sql procedure, which retrives xml data and shows as follows: ALTER PROCEDURE [dbo].[PROC_UTS_RATERECOMM_RECOMMDATA_XML_SET] ( @RETURN_CODE INT OUTPUT ,@RETURN_MESSAGE NVARCHAR(512) OUTPUT ,@XMLDATA xml ,@UTILITY_NAME NVARCHAR(50) ,@USER_CREATED_MODIFIED_BY NVARCHAR(50) ) AS BEGIN TRY print ‘1’ select x.value(‘@UtilityName’,’nvarchar(50)’) as UtilityName, x.value(‘@SuggestedRate’,’nvarchar(50)’) as SuggestedRate, x.value(‘@Client’,’nvarchar(50)’) as Client, x.value(‘@State’,’nvarchar(50)’) as State, x.value(‘@CurrentRate’,’nvarchar(50)’) as CurrentRate, x.value(‘@AccNo’,’nvarchar(50)’) as AccNo, x.value(‘@Savings’,’nvarchar(50)’) […]

Cannot create login in stored procedure with EXECUTE AS OWNER?

Running SQL Server 2014 Express. Logged on as sa I try to execute the code below. It gives me the following error: Msg 15247, Level 16, State 1, Line 25 User does not have permission to perform this action. Why?! If I select SYSTEM_USER inside the procedure, it is indeed sa (the rightful owner). USE […]

Return average deposit,withdrawal for last eight weeks in sql server

i want to write a simple query that will return me average deposits and bets from MyTable, but for last eight weeks starting from today and to have also in select first day of that week in format dd/mm SELECT [PlayerId], SUM(Aggr.DepositAmount) [Deposits], SUM(Aggr.DepositCount) [DepositCount], SUM(Aggr.WithdrawalAmount) [Withdrawals], SUM(Aggr.WithdrawalCount) [WithdrawalCount] FROM [WarehouseMgmt].[FactPaymentAgr] Aggr WHERE (TimeId BETWEEN […]

Start synchronization of replication subscriber from command line or stored procedure

We have a publisher and three subscribers. Two subscribers on the same LAN and a remote subscriber. Every night we face an issue where replication goes down and won’t restart. The message says: FAILED for each publisher. We are not sure what’s happening, but at night we have mantainance plans scheduled and I suspect that […]

Incorrect syntax near the keyword 'INNER' in DELETE query SQL Server error

I just wrote this DELETE query in SQL Server 2012 and I get an error: Incorrect syntax near the keyword ‘INNER’. when I execute it. Can anyone help? DELETE FROM Nhanvien INNER JOIN Hoadon ON Nhanvien.MaNV = Hoadon.MaNV WHERE YEAR(Ngaysinh) = ‘1994’ enter image description here EDIT:

Java In-memory database with SQL Server support

Which of the available in-memory databases has best support for SQL Server specific features? I’ve been trying with H2, but had problems for example with escaping column names: in all of our our sql queries we use the (non-standard) [FIELDNAME] instead of “FIELDNAME”. This is apparently not supported by H2. There might be also other […]

Performing operations on chunks of rows in SQL Server where the identifying column is of type nvarchar

I’m looking to perform some operations on potentially large data sets in SQL Server 2014. I’d like to do it in chunks (say, ~1000 rows at a time) but the hitch here is that the identity column of the table is an nvarchar type (storing a UUID). Breaking data into chunks where the IDs are […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.