How to Combine two column in one table using SQL statement ?

Could you write the simple SQL statement from 'Combine two column in one table '?

I try to use 'Union' which combine two column in two table . thx
2/17/2005 4:43:52 AM 29906 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 19

You can use the concatention operator (+):

column1 + column2 AS myColumn

Terri Morton
Engagement Manager, Neudesic

How to ask a question

2/17/2005 5:19:02 AM

If the columns are numeric then "+" will sum the column values.
If you do not desire this, you should use str() function

Check the below statement,
select ltrim(str(column1)) + ltrim(str(column2)) from mytable
2/21/2005 2:34:27 PM

Similar Artilces:

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

How to combine two columns into one in an sql
I have an stored procedure that returns 3 columns. Month, Date, and Total Number of Calls. Here is the stored Proc: SELECT DATEPART(mm, CALLSTARTTIME) ,  DATEPART(dd, CALLSTARTTIME), COUNT(*) FROM CALL_LOG_MASTER WHERE (COMMERCIALS = '1') AND (PINCODE IS NOT NULL) GROUP BY DATEPART(mm, CALLSTARTTIME), DATEPART(dd, CALLSTARTTIME) ORDER BY DATEPART(mm, CALLSTARTTIME), DATEPART(dd, CALLSTARTTIME) It returns a table: MONTH   DATE   TOTAL NUMBER OF CALLS=======   =====   ===========1      ...

Use two SQL statements in one SqlDataSource ?
Hello, I have SqlDataSource to retrieve a data into DetailsView, or GridView, whatever. I want to use two Select command like this: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=AHMED-4714D04B3;Initial Catalog=mp;Integrated Security=True" <% if (( parID == 3) || (ParID ==4) { SelectCommand="SELECT [PID], [PageID], [PageContent], [ParID], [ChiID] FROM [mp_page] WHERE ([ParID] = @ParID)"> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" Name="ParID" PropertyName="SelectedValue" /> </SelectParameters> ...

Merge two sql statements with derived table Sql Server 2005
I have two select statements that I need to merge into one record. I have a personcontact table that contains contact information and insurance information. (bad db design). below is what I have created so far based on what I have learned from Google searches but I get errors and I am not sure why   ThanksMsg 156, Level 15, State 1, Line 18 Incorrect syntax near the keyword 'Left'. Msg 156, Level 15, State 1, Line 29 Incorrect syntax near the keyword 'as'. select Top 1 pc.firstname + ' ' + pc.lastname as ContactName , A.Address1, A.Address2, A.cit...

Why these two SQL statement return differently? using ROUND() function in Transact-SQL
Hello, DECLARE @x DECIMAL SET @x = 65.554 SELECT ROUND(@x, 1) --this returns 66 SELECT ROUND(65.554, 1) --this returns 65.600 can someone explain to me why is like that?  Thank you   Always specify the size for the parameters. For example: Decimal(10,3). ***********************Dinakar NethiLife is short. Enjoy it.*********************** DECLARE @x DECIMAL(10,3) SET @x = 65.554 SELECT ROUND(@x,1) SELECT ROUND(65.554,1) both return the same answer. ndinakar & Motley Thank you two very much.  I got it.  :)...

combine two tables with different columns in sql sever
Hi, I have a requirement like.. One table has 12 columns for all month  with different year.  Lets say i need values from sep-2008 to Mar-2009. I need to select the values from sep-2008 to dec-2008 as a single table and jan-2009 to Mar-2009 values as a single table. Now i need to combine these two table as a single table. Please help how to combine two tables with different columns. Thanks, Prabha  The question is unclear (put samples of exact data structure, test data and desired output). I think you need to look at UNPIVOT operator in SQL Server 2005. Look at the H...

use 2 sql statements for one table in a report
does anyone knows how to use 2 sql statements for displaying data in one table?do i have to use subreports..? how do i do it anyway..? you shoudl use the union or make a procedure and call that procedure from reports can you give me an example on how to do it...?below are the sql statements that has to be combined.-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ALTER PROCEDURE dbo.sp_StockBalanceReport(   @ReportDate datetime) AS declare @Conv...

Using a variable to specify table column in sql statement??
Hello everyone, I'm still quite new, Visual Web Developer 2008, and SQL. It has been a fun learning experience so far. Anyways, the site I am designing needs to allow its users to extensively search several different databases (MS SQL databases).  I have followed many of the tutorials and have found it rather easy to add table adapters, gridviews and other data features that use basic SQL Select statements. One of the major database tables contains several columns which I would like to include as a search parameters from a drop down list. I was wondering if there ...

SQL statement to select two tables and sorted by an Order column
Maybe this will solve my problem without having two use ArrayList. I have two tables: Links and Page Links table contains: LinkTo and LinkFrom columns or fields. Page table contains all the pages including a column or Order. This Order field is use to display the order of the page on the web. So far I have the following: SELECT * FROM Links, Page WHERE (Links.LinkFrom = @FromID) The above statement gave me duplicates. I need to take the duplicates out and sorted by the Page.Order column. Help is appreciated. What columns do you have in your Pages table? Are you looking to get the ro...

Use VB.Net to get the column properties of a SQL table
I have a repeater, but I don't realy think that matters, what I want to to is find the length of a sql table column. so that I can set the length of a text box to it. the data I am working with comes from a datatable. I'm seeing something out there that might be the answer and it is DataTable.GetSchema but I'm not finding anything to show me how to use it. If that is the answer does someone know how to get the column lenth of the column you are looking for out of it, or how to get what I'm after so other way.  you can issue this sql statement select * ...

combining 2 sql statements using Access version and not sql server to show results in a data list
Hi, I have 2 sql statements which will run in Access: private string m_cmdInitial = "Select Distinct Mid([Attribute Name],1,1) AS Initial FROM [Attributes]";  private string m_cmdCustmrs = "SELECT * FROM [Attributes] WHERE(Attributes.[Attribute Name]) LIKE '{0}*'"; The thing is that using SQL server the two sql statements can be combined using the format Function of just by putting semicolon between the statements. The purpose is as follows: I am using 2 data lists. The first one is just a list of letters on top from which the user can choose a letter on which the term starts...

line break problem, I used the DetailsView to save an article to sql table, then I use label to read out from sql table, but couldn't break line.
Here is my code: <asp:Label ID="Label" runat="server" Text='<%# Eval("ServiceBody") %>'></asp:Label>Life is not easy but beautiful! use <asp:Label ID="Label" style="word-wrap:normal" runat="server" Text='<%# Eval("ServiceBody") %>'></asp:Label> and fix the widht of the colum in which you have placed this lable. like width=150px    If this post helps you, please mark it as Answer.Cheers,Muhammad Rizwan JavedSr .Net DeveloperAim 168, Dubai, UAE. Use ...

How to write SQL to form &quot;New Table&quot; from Job Revence and Job Cost using SQL statement ? thx
Edited by SomeNewKid. Please post code between <code> and </code> tags. // Pls copy the following HTML after that you generate the HTML page. Then you will know what I mean. I need to form "New Table" from Job Revence and Job Cost using SQL statement? thx -----------The following code----------------- <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=big5"> <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="

Wanting to take info from one SQL table and update to a seperate SQL table
Anyone have an idea of how I can take information from one table and edit it and insert into another SQL table.  I am using stored procedures and would like to continue to do so. Here is a copy of what I have so far:   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="mp_Customers" SelectCommandType="StoredProcedure"></asp:SqlDataSource> </div> <h2><strong><font color="#C00000">Please enter a valid account number:</font></strong><...

Web resources about - How to Combine two column in one table using SQL statement ? -

User:Jimbo Wales/Statement of principles - Wikipedia, the free encyclopedia
As we move forward with software and social changes, I think it is imperative that I state clearly and forcefully my views on openness and the ...

Category:Articles containing potentially dated statements from July 2011 - Wikipedia, the free encyclopedia ...
This is an administration category . It is used for administration of the Wikipedia project and is not part of the encyclopedia. It contains ...

Madonna says Sean Penn never assaulted her in court statement, denying previous reports
... of the allegations that have surfaced over the years accusing Sean of incidents of physical assault and abuse against me," she said in a statement ...

Statement from Premier League’s Crystal Palace Football Club
Crystal Palace Football Club is delighted to announce that it has today signed a deal with investors Josh Harris and David Blitzer. The deal ...

FOMC Statement: Fed Funds Rate target range increased to 1/4 to 1/2 percent
FOMC Statement: Information received since the Federal Open Market Committee met in October suggests that economic activity has been expanding ...

Chicago police statement on double fatal police shooting - Chicago Tribune
Chicago police emailed the following statement to the media at about 9:45 the morning of Dec. 26, 2015, after an early morning police-involved ...

What changed in new Fed statement
This is a comparison of today's FOMC statement with the one issued after the Fed's previous policy-making meeting on Oct. 28.

Does Draymond feel Warriors have chance to make statement vs Cavs?
... Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Does Draymond feel Warriors have chance to make statement ...

Dallas Stars: Cold facts: Loss to Blues 'clearly a statement' that Stars' upcoming divisional games will ...
Blues 3, Stars 0Click here for the full box score.Three Stars1. David Backes, Blues Goal, assist and fight give St. Louis captain the Gordie... ...

Rajon Rondo's Statement Looks A Lot Like Kobe Bryant's Statement
... pay after he called referee Bill Kennedy a “faggot” in a Dec. 3 game . (Kennedy publicly came out after the incident.) Rondo tweeted a statement, ...

Resources last updated: 12/27/2015 3:25:27 AM