Restrict User
Account using the application to connect to DB have datareader,datawriter and execute permissions. Application deletes data from sometable. How can I restrict the user to delete data only from these...
View ArticleGet total count before getting a subset from numbered results
I am returning a subset of search results (based on row_number()) but although I'm returning only, let's say, 10 rows, I need to also return the total count (grand total) that the search criteria would...
View ArticleNONCLUSTERED HASH index on memory optimized table
Indexes in memory optimized tables can be defined as NONCLUSTERED, HASH or NONCLUSTERED HASH. NONCLUSTERED indexes are B-tress good for non-equality filter options, while HASH indexes are good for...
View ArticleUpdating multiple columns in a single statement for a table according to...
I need to populate a table containing customers’ ageing with the remaining amounts in each of four columns. The customer’s record, which has columns Account No, Current, 30 Days, 60 Days, 90 Days +...
View ArticleDisplaying revenue to another employee
Hi guys,As you can see, my query below displays the revenue by name for those who active.Select First_Name, SUM(Total_Price*Num_Of_Products) from employees_new as E Inner join sales as S on...
View ArticleExport to an XML file - XML stay in tact
I have done a lot of research on how to export a query to an xml file and felt that I finally made a break through by having xml data in an actual xml file, however, it appears that it is not keeping...
View ArticleStaging Data
I am looking for feedback back on staging data. I have two options, 1) Creating a staging database for each source system, we have approximately 10-12 sources 2) Create one staging database and...
View ArticleColumn value into number of rows
Hi everyone :)I'm having this issue and any help will be really appreciated.I'm simplifying the example:This is the table:[code language="sql"]ProductID Units001 4<
View ArticleFind most recent occurence of a value changed
I am trying to write a query that allows me to find the first recent occurrence where a column value changed. I have provided some data to explain the scenario.[code language="sql"]
View ArticleImport wizard: change InputColumnWidth ?
Hello,I've a problem using the "Import Wizard" to load a table from a text file (Unicode).I've got this error (sorry in french):In brief, it says a data in column "Composition familiale" is truncated...
View Articlethe time is to go now to smoere
[url=https://wardvs-kovalev2.org]Ward vs Kovalev 2[/url][url=https://wardvs-kovalev2.org]Ward vs Kovalev 2 Live[/url][url=https://wardvs-kovalev2.org]Ward vs Kovalev 2 Live...
View ArticleQuicker Way to Get Accurate Row Count
We are currently using SQL Server 2014 (enterprise) for our source system and data warehouse. Our ETL has a row count validation that runs at the end of each ETL execution. It ties out the number of...
View ArticleStoring File in Table
Which is the best option to save files in a table.Varbinary(max) or Varbinary (Max) Filestream or Filetable. Max file size expect is 1GB and same time we expect 50 such files.I believe all 3 options...
View ArticleHow does this code convert records to a single row?
HiI stumbled across some SQL code which seems to transpose record data into a single record. Unfortunately the code was supplied "as is" without a useful explanation of how it works. Can anyone please...
View ArticleDynamic Pivot using XML as column list
I am trying to pull out a list of products from a product table, in the form of a comma separated and square bracket enclosed list. I then pass the list in to a pivot table so that in the future if any...
View ArticlePartition by error
Hi guys,So i am trying to display the percent of amount_paid by each item_name, divided by amount_paid of all itemsNote that i dont wanna GROUP BY it. I need to display each of the items the number of...
View ArticleWhere to use ISNULL to convert NULL in PIVOT result set
Hi,I can't figure out where to use ISNULL (or COALESCE) to convert NULL values in the pivot result set to 0. I need to do this because I will be using UNPIVOT to transform the data and it discards any...
View ArticleIf statement in T-SQL
Hi guys,I am trying to display item_name with a new category, which says the following term ( i have pasted my whole query) :declare @item varchar(50) Select @item = item_name from order_itemsIf @item...
View ArticleSQL Server 2014 Performing slow
Hi,I've recently upgraded from SQL-2005 to SQL-2014. Now I am observing that performance of SQL-2014 is very slow many times(worst than 2005). Even SP_Who2 commands take 25 seconds to execute and many...
View ArticleInsert multiple of 50 records into tables of headers and rows.
Hello,I would like to insert from a table of articles with (1113 records), in a table (a) headers and (b) lines, insertions of 50 rows in 50 rows, for each header.That is, in table (a) the record a1...
View Article