Relative Content

Tag Archive for sqlsql-servert-sql

Find occurrence of transport status

I have 2 Tables “Transport_Status” and “Receipts” where the id number is the key and can occur in Transport_Status more than once.

Insert leading spaces, then the value to a field in varchar(10)

I’m using the database (SQL Server) of an old program, and want to make batch inserts on the SUPPLIERS table which key is varchar(10). The thing is that the old program fills the key with leading blankspaces to complete the 10 characters, example (underscore represents blankspace)
=’_______310′, ‘_______311’…, ‘______1000’.

how to insert leading spaces, then the value to a field in SQL SERVER varchar(10)

I’m using the database (sql server) of an old program, and want to make batch inserts on the SUPPLIERS table which key is varchar(10). The thing is that the old program fills the key with leading blankspaces to complete the 10 characters, example (underscore represents blankspace)
=’_______310′, ‘_______311’…, ‘______1000’.

How to select the next lowest value and next highest value from a specific record value that’s been flagged?

EmployeeID EffectiveDate EndDate Salary ContractFlag 100 01/01/2022 12/31/2022 10,000 Completed 100 01/01/2023 12/31/2023 20,000 Completed 100 01/01/2024 12/31/2024 30,000 Active 100 01/01/2025 12/31/2025 40,000 Pending 200 01/01/2022 12/31/2022 25,000 Completed 200 01/01/2023 12/31/2023 35,000 Completed 200 01/01/2024 12/31/2024 35,000 Active 200 01/01/2025 12/31/2025 40,000 Pending 300 01/01/2022 12/31/2022 10,000 Completed 300 01/01/2023 12/31/2023 20,000 Completed […]