Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 create space between two fiels

Author  Topic 

veronika.np
Starting Member

29 Posts

Posted - 2011-07-11 : 12:16:03
hi friends,
i have two column name and family.i want to have some spaces between name and family .how can i do this.i want to like this
name family

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-11 : 12:20:36
Assuming name and family are character type columns
select
name + ' ' + family as NameAndFamily
from
YourTable
Go to Top of Page

veronika.np
Starting Member

29 Posts

Posted - 2011-07-11 : 13:04:09
quote:
Originally posted by sunitabeck

Assuming name and family are character type columns
select
name + ' ' + family as NameAndFamily
from
YourTable




no,i want to have some spaces like this

name family
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-11 : 14:28:31
May be I am not following the exact thing you are trying to do. If you want more spaces, you can insert more spaces into the query:
select
name + ' ' + family as NameAndFamily
from
YourTable
But I suspect that is not what you are looking for. In most cases, if you are doing this for display purposes, it is easier and better to do it in the code that displays the data. Nonetheless, can you explain once more what you are after?
Go to Top of Page

veronika.np
Starting Member

29 Posts

Posted - 2011-07-12 : 10:35:41
quote:
Originally posted by sunitabeck

May be I am not following the exact thing you are trying to do. If you want more spaces, you can insert more spaces into the query:
select
name + ' ' + family as NameAndFamily
from
YourTable
But I suspect that is not what you are looking for. In most cases, if you are doing this for display purposes, it is easier and better to do it in the code that displays the data. Nonetheless, can you explain once more what you are after?



i write select name+space(10)+family from mytable
in sql space show but in asp.net doesn,t show space.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-07-13 : 09:19:02
If you are using ASP.NET, then add the spaces THERE, not in SQL Server.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2011-07-13 : 09:40:13
In ASP... or HTML rather... you'll need to add   to represent each space.

Corey

I Has Returned!!
Go to Top of Page
   

- Advertisement -