[Requirements]
- SQL a procedure creating a new account in canteen system
[OS]
Windows Server 2021 R2
[Development Language]
SQL
[IDE]
SSMS(SQL Server Management Studio)
[Setting]
-
[Code]
USE [YTC_OPERATION]
GO
/****** Object: StoredProcedure [dbo].[CREATE_USER] Script Date: 2024-03-04 오후 4:27:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[CREATE_USER](@name nvarchar(20), @id nvarchar(10), @pw nvarchar(10), @qty int)
AS
BEGIN
INSERT USRS_temp (EMID, Name, Tele, PSWD, Stat, UDLQ)
VALUES ((select max(cast(emid as int))+1 from usrs_temp), @name, @id, @pw, 'W', @qty)
END
[Test]
exec CREATE_USER /*이름*/'하하하', /*ID*/'1004', /*비밀번호*/'1004', /*식대수*/1
select * from USRS_temp where Name ='하하하'
[Lesson Learned]
- Column type configuration should be done with full consideration otherwise data parsing query step is demanded and it would be a big pain
반응형
'ICT' 카테고리의 다른 글
[PowerShell] Remote Session Connection Issue Remediation (0) | 2024.03.12 |
---|---|
[ServiceNow] Inbound Action for Backup Fail Issue (0) | 2024.03.06 |
[PowerShell] Sending ActiveDirectory User List Weekl (0) | 2024.02.29 |
[PowerShell] MECM(Microsoft EndPoint Configuration Management) Script Run/Reinstall Client Bulkily (0) | 2023.12.21 |
[PowerAutomate] Unable to Fetch JSON Data from LogicApp (0) | 2023.12.21 |
댓글