T-SQL Variable Decision Flowchart
Start
│
▼
Read the Question
│
▼
Does the question require **input from user or predefined value**?
├─ Yes → Declare a variable for the input → Use SET to assign value
│
└─ No → Skip input variable
│
▼
Does the question require **fetching data from table**?
├─ Yes → For each piece of data to fetch (column) → Declare separate variable
│ Use SELECT to assign values from table into variables
│
└─ No → Skip table variables
│
▼
Does the question require **printing/displaying output**?
├─ Yes → Use the variables declared for outputs → PRINT them
│
└─ No → Skip PRINT
│
▼
End