กิจกรรม
31 มี.ค. 23 - 2 เม.ย. 23
อิเกีย เหตุการณ์การเรียนรู้ SQL, Fabric และ Power BI ที่ใหญ่ที่สุด 31 มีนาคม – 2 เมษายน ใช้รหัส FABINSIDER เพื่อบันทึก $400
ลงทะเบียนวันนี้เบราว์เซอร์นี้ไม่ได้รับการสนับสนุนอีกต่อไป
อัปเกรดเป็น Microsoft Edge เพื่อใช้ประโยชน์จากคุณลักษณะล่าสุด เช่น การอัปเดตความปลอดภัยและการสนับสนุนด้านเทคนิค
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
This function returns the application name for the current session, if the application sets that name value.
ข้อสำคัญ
The client provides the application name, and APP_NAME
does not verify the application name value in any way. Do not use APP_NAME
as part of a security check.
Transact-SQL syntax conventions
APP_NAME ( )
nvarchar(128)
Use APP_NAME
to distinguish between different applications, as a way to perform different actions for those applications. For example, APP_NAME
can distinguish between different applications, which allows for a different date format for each application. It can also allow for the return of an informational message to certain applications.
To set an application name in Management Studio, click Options in the Connect to Database Engine dialog box. On the Additional Connection Parameters tab, provide an app attribute in the format ;app='application_name'
This example checks whether the client application that initiated this process is a SQL Server Management Studio
session. It then provides a date value in either US or ANSI format.
USE AdventureWorks2022;
GO
IF APP_NAME() = 'Microsoft SQL Server Management Studio - Query'
PRINT 'This process was started by ' + APP_NAME() + '. The date is ' + CONVERT ( VARCHAR(100) , GETDATE(), 101) + '.';
ELSE
PRINT 'This process was started by ' + APP_NAME() + '. The date is ' + CONVERT ( VARCHAR(100) , GETDATE(), 102) + '.';
GO
กิจกรรม
31 มี.ค. 23 - 2 เม.ย. 23
อิเกีย เหตุการณ์การเรียนรู้ SQL, Fabric และ Power BI ที่ใหญ่ที่สุด 31 มีนาคม – 2 เมษายน ใช้รหัส FABINSIDER เพื่อบันทึก $400
ลงทะเบียนวันนี้