Q:

How to add @ symbol before column value and separate with ' , '?

I want to add @ symbol to a column name and separated each by ',' 
I tried with substring() as the following:
declare @tmp varchar(250) SET @tmp = '' 
select @tmp = @tmp + COLUMN_NAME + ', @'  FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_NAME ='tbl_emp'
select SUBSTRING(@tmp, 0, LEN(@tmp)) as new column

The column names are: 
+--------------+
| COLUMN_NAME  |
+--------------+
| empName      |
| workinhDate  |
| Workinghour  |
+--------------+ 

The output should be like:
+-------------------------------------+
|             ColumnNames             |
+-------------------------------------+
|  @empName,@workinhDate,@Workinghour |
+-------------------------------------+

A:

I think you meant:
DECLARE @tmp VARCHAR(250)
SET @tmp = ''
SELECT  @tmp = @tmp + '@' + COLUMN_NAME + ', '
FROM    INFORMATION_SCHEMA.COLUMNS
WHERE   TABLE_NAME = 'tbl_emp'

SELECT  LEFT(@tmp, LEN(@tmp) - 1)

Also, substring in sql server is 1 based, not 0.

