我是SQL的初学者 我找不到这条线:
type in (N P , N PC )
是什么条款:P、PC、U?
编辑:
完整的查询是 :
IF EXISTS (SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N [dbo].SP_AUTHENTIFICATION] )
AND type in (N P , N PC ))
我是SQL的初学者 我找不到这条线:
type in (N P , N PC )
是什么条款:P、PC、U?
编辑:
完整的查询是 :
IF EXISTS (SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N [dbo].SP_AUTHENTIFICATION] )
AND type in (N P , N PC ))
首先是什么关系数据库管理系统?
然而,我怀疑 type
是表格中的一列或存储程序中的变量。
N
,意味着您将下一字符串重新转换为 nchar
, nvarchar
或 nvarchar2
(取决于 RDBMS)。这些数据类型允许多字字符。
PC
和 P
是字符串。
将这些全部组合在一起, 您可以将 PC
和 P
转换为多个字节字符集, 检查列或变量 type
是否与这些字符串之一相同 。
in
表示 type
可以是 或 PC
或 P
。
根据您的评论使用 SQL- Server
您重新检查对象 < code> [dbo] 。 [SP_Authentiration] 是否存在,并且是一个存储程序(P)或组装存储程序(PC)。
type
type 列在 sys.objects
不是 nchar
,所以转换毫无意义。
点点一行进
IF EXISTS
- If the result of the following query in brackets returns a row:SELECT * FROM sys.objects
- Select a row from sys.objects
WHERE object_id =
- Where the object_id
is equal to the followingOBJECT_ID(N [dbo].[SP_AUTHENTIFICATION] )
- Return the object_id
of [dbo].[SP_AUTHENTIFICATION]
AND type in (N P , N PC )
- and where that object is a stored procedure.U
,不在您的查询中,它正在检查 type
是否是一个表格。 文档 提供完整的列表。
如果您希望您的问题对其他人有用,评论意见中的详细内容属于问题正文,因为这些识别符号只有在 sysobbjects
表格中才有意义。
这就是意义所在。
因此,您的条款会检查是否存在任何名为 sp_authetication
的程序。
该行正在寻找一个名为 SP_Authentenization 的存储程序, 如果它存在, 可能会丢弃它。 这在 SQL 服务器中非常常见, 因为 SQL 服务器没有 CreateOrAlter 。
我找到了更好的方法 来运行一个创建OrAlter, 这样历史就可以保存在存储程序上。
if not exists(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N [dbo].[myproc] ) AND type in (N P , N PC ))
exec( create proc dbo.myproc as select 0 )
alter proc dbo.myproc
as
...
I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...
I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2
I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...
we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...
I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...
I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...