Get the full course. Here's the link! https://www.udemy.com/course/stored-p...
If you want to make your queries more flexible, then watch this video to learn how you can add variables to your SQL Server scripts and stored procedures.
Check out our channel at @EssentialSQL to learn even more about SQL Server.
Do you love our videos? If so, you're sure to like our blog! Check it out at https://www.essentialsql.com/blog/
Here are the scripts for those interested:
--Simple Select
select *
from Person.Person
Where LastName like 'Ral%'
--Select with variable in Query
declare @LastNamePattern as varchar(40);
set @LastNamePattern = 'Ral%'
select *
from Person.Person
Where LastName like @LastNamePattern
--Make it a stored procedure and run it!
alter procedure PersonSearchLastName(@LastNamePattern as varchar(20))
AS
begin
select *
from Person.Person
Where LastName like @LastNamePattern
end
exec dbo.PersonSearchLastName 'Kal%'
In questa pagina del sito puoi guardare il video online Using Variables in SQL Queries for Scripts and SQLServer Stored Procedures | Essential SQL della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Essential SQL (EssentialSQL) 05 marzo 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 18,811 volte e gli è piaciuto 258 spettatori. Buona visione!