473,609 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 56059
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****@REMOVEy ahoo.dk> wrote in message
news:40******** *************@d read11.news.tel e.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*******@nosp am-earthlink.net> wrote in message
news:Xa******** **********@news read3.news.atl. earthlink.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
6247
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 No (pn) Sequence (seq) Long Description (long_desc) --------------- --------------- ---------------------------------------- HL1450 10 This is part of a long description and HL1450 20 it overlaps onto several lines. I'm HL1450 30 having difficulty writing...
1
4375
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 which is YYYYMMDD. I know the format is strange but it will make things easier in the long run if all of the dates are the same when working between the 2 different databases. Basically, I need to take a look at the year portion (with a SUBSTRING...
1
6568
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 display, separated by a comma. For example, in the query is a row is named BC and a column named Vancouver, it currently displays "4" for the number of instances that Vancouver appears combined with the BC field. However, what I would like to display...
8
9578
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 record for my mail merge, so I would like to concatenate the 6 to 8 records into 1 with the text field that is different in each record being concatenated into a single text field with a carriage return/line feed at the end of each record so it comes...
12
16485
by: parth | last post by:
Hi I want to achieve the following transformation of data using a stored procedure. Source col1 col2(varchar) -------------------------
5
13856
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 the dropdown with the value from the database. The value in the database is either new, trial, maint., employee, beta, or null. I need to set the dropdrown to one of these values. An example of the select; <td> <select name="ordReason">...
1
1836
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 rightside.. 2 frontside 2 leftside 3 rightside
1
2397
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 apparently baffled by this operator in TableAdapter queries, as it gives an error and does not generate parameters. It also likes to crash completely when I select the option to ignore the error and continue. I have only managed to successfully create...
2
1923
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 a text field. The text is what you see in the combo box on the form but it's one of those bound to column 1 (auto id), column count is 2, column widths are 0" and 3" kind of things (my experience with Access 2003 is that this was a common thing to...
0
8145
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6068
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4037
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2541
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.