SQL Server REPLICATE()ฟังก์ชัน
ตัวอย่าง
ทำซ้ำสตริง:
SELECT REPLICATE('SQL Tutorial', 5);
ความหมายและการใช้งาน
ฟังก์ชัน REPLICATE() ทำซ้ำสตริงตามจำนวนที่ระบุ
ไวยากรณ์
REPLICATE(string, integer)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
string | Required. The string to repeat |
integer | Required. The number of times to repeat the string |
รายละเอียดทางเทคนิค
ทำงานใน: | SQL Server (เริ่มตั้งแต่ปี 2008), ฐานข้อมูล Azure SQL, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
ตัวอย่างเพิ่มเติม
ตัวอย่าง
ทำซ้ำข้อความใน CustomerName สองครั้ง:
SELECT REPLICATE(CustomerName, 2)
FROM Customers;