Tag: database

What is a good way to open large files across a WAN?

I have an application deployed into multiple zones and there are some issues with opening larger documents (20-50MB) across the WAN. Currently the documents are stored in Zone 1 (Americas) and a link stored in the database to the docs. I have heard some things about blobs in oracle and store binary in MS SQL […]

SQL Server query to hide duplicate rows column data. Don't want to remove a duplicate row

SQL Server query to hide duplicate rows column data. Don’t want to remove a duplicate row. conditionally display data as blank. When, I run this SQL query: select [Vch No.], [Vch Type], [Vch Ref], [Date], [Party Name], [Sales Ledger], [Amt], [GST Ledger], [TaxAmount], [Total] from [AccountData] I am getting this output: But, I need output […]

Coalesce vs Sargability

The company that I work for uses a third party software, and we don’t have any exposure to the application code, so I cannot change much the DB objects. I’m trying to do some work around in a view that is not Sarg, there is a coalesce to replace nulls to 0 within the view, […]

Sql: Get Attributes by joining 3 tables

This is my database schema: I simply want to Select all the appointments of a patient and get the following result set: I’ have tried the following Join: SELECT [User].user_id,name, surname, [Appointment].day,[Appointment].month,[Appointment].year,[Appointment].hour,[Appointment].minutes FROM [User] LEFT JOIN [Doctor] ON [Doctor].user_id = [User].user_id LEFT JOIN [Patient] ON [Patient].user_id = [User].user_id LEFT JOIN [Appointment] ON [Doctor].doctor_id = [Appointment].doctor_id […]

Must declare the scalar variable error when inserting a foreign key

I am having this problem when I’m trying to insert data into a database with a button and textboxes. Everything works fine except a foreign key that is inside the table throws this error: Must declare the scalar variable “@IDprodajalne” I am getting kind of desperate so I really need your help now. if (textBoxImeProdajalca.Text […]

How does the CACHE option of CREATE SEQUENCE work?

CREATE SEQUENCE has CACHE option MSDN defines it as [ CACHE [<constant> ] | NO CACHE ] Increases performance for applications that use sequence objects by minimizing the number of disk IOs that are required to generate sequence numbers. Defaults to CACHE. For example, if a cache size of 50 is chosen, SQL Server does […]

Arranging Rows with Similar Column Data Together After Using ORDER BY

Using ORDER BY Date DESC in this table: Number | Date 1 | 07/18/2017 1 | 07/18/2017 1 | 07/18/2017 1 | 07/18/2017 2 | 07/18/2017 2 | 07/18/2017 2 | 07/18/2017 1 | 07/18/2017 1 | 07/18/2017 2 | 07/19/2017 3 | 07/19/2017 3 | 07/19/2017 3 | 07/19/2017 4 | 07/19/2017 4 | […]

how to add last values of same group in sql query

I have a table like this attribute_id product_id quantity 1 101 10 2 101 7 3 101 8 4 102 2 5 102 8 6 102 6 7 103 30 8 103 25 9 103 20 After the query, I want to find a query like this. This is the semi-answer attribute_id product_id quantity 3 […]

SQL Group by Client Location

Sample of Data I am trying to manipulate Order | OrderDate | ClientName| ClientAddress | City | State| Zip | ——-|———–|———–|—————|——–|——|——-| CO101 | 1/5/2015 | Client ABC| 101 Park Drive| Boston | MA | 02134 | C0102 | 2/6/2015 | Client ABC| 101 Park Drive| Boston | MA | 02134 | C0103 | 1/7/2015 | […]

make a combination (variations) of records on the basis of a dynamic column value (attributes) using sql

I have a table which contains Attributes AttrId Title 1 | Color 2 | Size 3 | Style Another Table which contains Variants Id | ProductId | AttrId | Value 1 | 1 | 1 | Red 2 | 1 | 1 | Green 3 | 1 | 1 | Blue 4 | 1 | […]

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