I’m beginner in SQL. I can’t find what is this line:
type in (N'P', N'PC')
What is in where clause: P, PC, U?
EDIT:
The full query is:
IF EXISTS (SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].SP_AUTHENTIFICATION]')
AND type in (N'P', N'PC'))
First off what Relational Database Management System?
However, I suspect that
typeis a column in a table or a variable in your stored procedure.N, implies that you’re converting the next string to anchar,nvarcharornvarchar2(depending on RDBMS). These are data-types that allow multi-byte characters.'PC'and'P'are strings.Putting this all together you’re converting
'PC'and'P'to a multi-byte character set and checking whether the column or variabletypeis the same as one of these strings.inmeans thattypecan be the same as either'PC'or'P'.From your comment you’re using SQL-Server
You’re checking whether the object
[dbo].[SP_AUTHENTIFICATION]exists and is a stored procedure (P) or a assembly stored procedure (PC).The column
typeinsys.objectsis not anncharso the conversion is fairly pointless.Going point by point
IF EXISTS– If the result of the following query in brackets returns a row:SELECT * FROM sys.objects– Select a row fromsys.objectsWHERE object_id =– Where theobject_idis equal to the followingOBJECT_ID(N'[dbo].[SP_AUTHENTIFICATION]')– Return theobject_idof[dbo].[SP_AUTHENTIFICATION]AND type in (N'P', N'PC')– and where that object is a stored procedure.U, which isn’t in your query is checking to see whether thetypeis a table. The documentation gives you a full list.