Declare @Count tinyint
Declare @Count2 tinyint
SELECT @Count2 = Count(*) FROM table where artno = @new
If @Count2 != 0
BEGIN
delete from table where artno = @new
END
I could not know what these lines of codes in the stored procedure in SQL Server are doing exactly.
I have looked into the definition of and use of count() after that as well not able to figure it out. Especially the = in the code confuses me a lot as well as * in the `count(*)´.
I am beginner so would like to apologize if its quite elementary question, I got to understand though.
gets the number fo records where
artnois equal to the content in your@newvaraible and stores that number in the@Count2variable.deletes all records where
artnois equal to the content in your@newvaraible, if the@count2is not0BTW the
@Countvariable is not used in that code and is obsolete.