space

生成口令

Space是功能生成一個由空格組成的指定字元個數的字元串

基本信息


令
語 (  )
space[生成口令]
space[生成口令]
參:類型,指填充空,填充返符串返值。函執功返空組符串,錯誤返空符串。參值,()函返。函:返復空組符串
返回由重複的空格組成的字元串。
語法
SPACE (integer_expression)
參數
integer_expression
是表示空格個數的正整數。如果integer_expression為負,則返回空字元串。
返回類型
註釋
若要在 Unicode 數據中包括空格,請使用REPLICATE而非 SPACE。

主要應用


示例
下例剪裁作者的姓氏並串聯一個逗號、兩個空格和作者的名字。
USE pubsGO SELECT RTRIM(au_lname) + ',' + SPACE(2) + LTRIM(au_fname)FROM authors ORDER BY au_lname, au_fnameGO
下面是結果集:
Name --------------------------------------------------------------- Bennet, Abraham Blotchet-Halls, Reginald Carson, Cheryl DeFrance, Michel del Castillo, Innes Dull, Ann Green, Marjorie Greene, Morningstar Gringlesby, Burt Hunter, Sheryl Karsen, Livia Locksley, Charlene MacFeather, Stearns McBadden, Heather O'Leary, Michael Panteley, Sylvia Ringer, Albert Ringer, Anne Smith, Meander Straight, Dean Stringer, Dirk White, Olivier Yokomoto, Akiko (23 row(s) affected)