473,385 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

concatenate two column.

SWN
hi.

Trying to concatenate two columns:

select uname+' '+uaddress as NameAdr from tblUser

I only get the first field, name!!??
The datatype is both nvarchar. 100 and 50 chars long.

If I run this query:

select uname, uaddress from tblUser

theres no problem.

Any suggestions?

Thanks

SWN
Jul 20 '05 #1
2 56047
I get the expected results with the script below. Does this work for you?
If not, please post a complete script that illustrates the problem.

CREATE TABLE tblUser
(
uname nvarchar(100) NOT NULL,
uaddress nvarchar(50) NOT NULL
)

INSERT INTO tblUser VALUES('John', 'abc')
INSERT INTO tblUser VALUES('Mary', 'def')

SELECT
uname + ' ' + uaddress AS NameAdr
FROM tblUser

--
Hope this helps.

Dan Guzman
SQL Server MVP

"SWN" <sv****@REMOVEyahoo.dk> wrote in message
news:40*********************@dread11.news.tele.dk. ..
hi.

Trying to concatenate two columns:

select uname+' '+uaddress as NameAdr from tblUser

I only get the first field, name!!??
The datatype is both nvarchar. 100 and 50 chars long.

If I run this query:

select uname, uaddress from tblUser

theres no problem.

Any suggestions?

Thanks

SWN

Jul 20 '05 #2
SWN

"Dan Guzman" <da*******@nospam-earthlink.net> wrote in message
news:Xa******************@newsread3.news.atl.earth link.net...
I get the expected results with the script below. Does this work for you?
If not, please post a complete script that illustrates the problem.

CREATE TABLE tblUser
(
uname nvarchar(100) NOT NULL,
uaddress nvarchar(50) NOT NULL
)

INSERT INTO tblUser VALUES('John', 'abc')
INSERT INTO tblUser VALUES('Mary', 'def')

SELECT
uname + ' ' + uaddress AS NameAdr
FROM tblUser


Hi Dan.

I've just found the problem.
The db was portet from paradox to SQL Server.
I found that the all strings in the uname field ended with a square! ie. a
weird char.
I could not see it in the query analyzer. I saw by coincident in the open
table->return all rows
There must be a difference between those two??!!

That mean I will have to update all the fields with minus one character. ;o(

Thanks Svend
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nick Heppleston | last post by:
I have a concatenation problem and I was wondering if somebody might be able to offer some help :-) I have the following table structure holding product long descriptions: Part...
1
by: Milo Woodward | last post by:
I have some columns of data in SQL server that are of NVARCHAR(420) format but they are dates. The dates are in DD/MM/YY format. I want to be able to convert them to our accounting system format...
1
by: Big Time | last post by:
I've got a crosstab query that counts the number of values in one of my tables. However, rather than giving me the number of instances of each record, what I would like is for each value to...
8
by: Dixie | last post by:
I have the results of a query to send to a mailmerge with Word 2000. The query produces say 6 to 8 records, where only 1 of the fields is different from record to record. I can only have one...
12
by: parth | last post by:
Hi I want to achieve the following transformation of data using a stored procedure. Source col1 col2(varchar) -------------------------
5
by: =?Utf-8?B?bWNhdWxpZmZl?= | last post by:
I have an old application ( pre-VB5) that I need to add a select/option list to. This is an edit program so the values for the form will be retrieved from a database. How do I set the value of...
1
by: CreativeMind | last post by:
hi all , actually i am binding a datagrid with a dataview which has a datatable showing output like this.. propertyid viewname 1 fronside 1 lefttside 1 ...
1
by: virax | last post by:
Hello all, I'm working on a solution that interfaces with a PostgreSQL db, which occasionally uses the || operator to concatenate column values in a SELECT statement. Visual Studio 2005 is...
2
AccessIdiot
by: AccessIdiot | last post by:
As usual, this seems like a really simple problem but it is stumping me. I am using Access 2007. I have a form with a combo box that is fed by a look up table. The look up table has an auto id and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.