Tagged Questions
Microsoft SQL Server is a relational database management system (RDBMS). Use this tag for all SQL Server editions including Compact, Express, Azure, Fast-track, APS (formerly PDW) and Azure SQL DW. Do not use this tag for other types of DBMS (MySQL, PostgreSQL, Oracle etc.). Do not use this tag for ...
0
votes
2answers
34 views
check if record exist with multiple conditions else insert in sql server stored procedure
I've written procedure as below to check for the record of day and slot combination with teacher or classroom or (specific standard and Division) as below.
ALTER procedure [dbo].[procCreateSchedule]
...
0
votes
2answers
29 views
C# SQL Subtract Product Quantity at FIFO
I just wondering how to subtract quantity of the same product with different date expiration.
Example
Table Inventory:
Product | Qty | Expiration |
--------+-----+------------+
Oreo | 2 | 10/...
1
vote
1answer
18 views
T-Sql How to get Max dated records?
I want max dated rows for per GroupCode
I wrote this.
SELECT FH.BelgeNo AS FaturaNo
,FHD.UrunId
,FH.Tarih
,UG.Grup AS GrupKodu
,FHD.Kodu
,FHD.UrunAdi
,FHD.BirimFiyat
FROM ...
1
vote
1answer
20 views
SQL Server - filtering tables by name with GUI
I have createda Linked Server on server X to be able to query server Y.
there is a possibility to filter the tabels on server Y by name from server X Linked server GUI?
this is how it is look like ...
0
votes
1answer
25 views
Customer partitioning in sql query
I have a table with following format -
Customer_id Purchase_date
c1 2015-01-11
c2 2015-02-12
c3 2015-11-12
c1 2016-01-01
c2 ...
0
votes
0answers
12 views
Read image from SQL Server to path
Is there any way to read image from a SQL Server VARBINARY(MAX) column to output folder without using any 3 rd party software?
Just using T-SQL and query
0
votes
1answer
13 views
Microsoft SQL Server on Linux (docker) - connection refused
I'm trying to connect from my Asp.Net Core app to my MSSQL which I run using docker, but I'm getting an error message:
"A network-related or instance-specific error occurred while
establishing a ...
0
votes
0answers
14 views
No data returned from database with php
I am building a PHP page to read data from an Azure SQL database. It seems like connection and query works, but I can't get any returned data to show.
The output I get on the web page is
...
2
votes
3answers
38 views
Where clause on INNER JOIN
I have four tables. I need to get data from all of them. Table 'Tenancy_histories' contains the move_in_date, move_out_date, rent columns. 'Profiles' contains the first_name, last_name, email, ...
-1
votes
3answers
23 views
SQL DATEDIFF in an sql query
I have two tables Customers and Purchases:
Customers table:
+------------+-----------+----------+
| CustomerID | FirstName | Surname |
+------------+-----------+----------+
| 101 | Jeff ...
0
votes
0answers
9 views
Running Queries in Parallel form in SQL
I'm working in Google Cloud SQL. One thing is confusing me. If you run multiple queries at once either they run parallel or not.
For example
SELECT * FROM tbl1
UPDATE tbl2 SET column = '...
-1
votes
0answers
7 views
How to get the Start&End of Week, First&Last Day of Month,Year Using SQL Sever?
--DateFormat WRT to MM/DD/YYYY
Declare @WRTDATE DATETIME = GETDATE()
--Declare @WRTDATE DATETIME = '10-30-2010'
SELECT *,DATENAME(dw,R.Value) AS DayOfWeekName FROM (
SELECT @WRTDATE AS DateValue, ...
1
vote
2answers
30 views
Building railway timetable
I am hoping to build a railway time table using asp.net web api & sql server database.
Below is the sample db design of the time table. I used this query to try out finding algorithm for the ...
0
votes
2answers
13 views
There is already an object named '#DIR_Cat' in the database
In my Stored procedure, I have added a command to create a hash temp table #DIR_CAT. But every time I execute the procedure I get this error:
"There is already an object named '#DIR_Cat' in the ...
0
votes
0answers
34 views
How to insert row into 2 tables with a one-to-one relationship in SQL Server
Suppose I have 2 tables with a one-to-one relation:
tblOrder (orderId, orderName, totalPrice, billId)
tblBill (billId, billAmount, cardNumber)
The orderId in tblOrder and billId in tblBill are the ...