Is there a way to force NHibernate to run a query without executing it as a parameterized query. Basically I’m running into an issue where I am hitting SQL Server’s 2100 parameter limit. I’m hitting a limit because of an “IN” restriction on my query. For reasons I won’t get…
Tag: sql-server
Why does the table randomly reorganize the rows?
I have the following table DBName Server Status UpdateTime DB1 server1 NULL 5/4/2019 DB1 server1 NULL NULL DB2 server2 NULL 6/4/2019 DB2 server2 NULL 6/4/2019 DB3 server2 NULL NULL …
Join repeatedly until a string is present?
While querying a subset of our employees, I’m trying to add a field for the SVP they “roll up” to. Employees may have anywhere from 1 to 5 or 6 degrees of separation from their SVP. The trouble is, …
SQL OPENQUERY, Incorrect syntax near ‘+’
I have this sql query: DECLARE @VAR varchar(8) SET @VAR = ‘20140202’ SELECT * FROM OPENQUERY([NMD],’SELECT * FROM NmdItemGroups01.dbo.InvTranDtl WHERE TranDate = ”’ + @VAR + ””) But when I run …
Sql stored procedure Count equity turnover for brooker
I’m trying to count a brookers qty turnover, total buy sum, total sell sum. The problem is when the buyer is also the seller in which case the brooker has turnover the equities once on the buy side …
Create new date ranges from overlapping date ranges and assign an ID
I have the following table ID | START_DATE | END_DATE | FEATURE ————————————— 001 | 1995-08-01 | 1997-12-31 | 1 001 | 1998-01-01 | 2017-03-31 | 4 001 | 2000-06-14 | 2017-…
Why does MS SQL allow you to create an illegal column?
I recently saw a tweet stating that you could prevent other developers from reading from a table using the SELECT * FROM TableName by building your table in the following way: CREATE TABLE [TableName]…
XML load is slow. Using text() when reading XML file with attribute-centric mapping
I am reading in an XML file into the database. It works fine however it is very slow. I was wondering if I can use text() in order to speed the process up similarly to the solution in this post: Xml …
SQL Combining two different tables
(P.S. I am still learning SQL and you can consider me a newbie) I have 2 sample tables as follows: Table 1 |Profile_ID| |Img_Path| Table 2 |Profile_ID| |UName| |Default_Title| My scenario is,…
Filter rows over partitions
Suppose I have the following table: +——-+————+ | nGroup | Status | +——-+————+ | 1 | DONE | | 1 | UNKNOWN | | 1 | DONE | …