| | |
SQL Server Question...
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
Hi,
I have one question related to SQL Server. But there is not forum on this. so here is my Question.
While accessing multiple columns value in a single alias column we right query as follows.
Am I right ?
But the question is when one of values from FNAME, MNAME, LNAME if comes NULL then my NAME filed will be NULL.
How to avoid this?? Any one have solution for this.
Note : I am using this Query for Creating VIEW.
Thanks. Have a Lovely Time.
I have one question related to SQL Server. But there is not forum on this. so here is my Question.
While accessing multiple columns value in a single alias column we right query as follows.
ASP.NET Syntax (Toggle Plain Text)
Select FNAME +' '+ MNAME +' '+ LNAME as NAME from Cust_Master
Am I right ?
But the question is when one of values from FNAME, MNAME, LNAME if comes NULL then my NAME filed will be NULL.
How to avoid this?? Any one have solution for this.
Note : I am using this Query for Creating VIEW.
Thanks. Have a Lovely Time.
Accept Challenges and Enjoy Coding... :)
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
Scratch that! Use a predefined function called COALESCE. It's a life saver. Format:
COALESCE(columnname, 'valueifnull')
COALESCE(columnname, 'valueifnull')
ASP.NET Syntax (Toggle Plain Text)
Select COALESCE(FNAME, '') +' '+ COALESCE(MNAME, '') +' '+ COALESCE(LNAME, '') as NAME from Cust_Master
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
This way if middle nam eis null or something, it will show:
FNAME LNAME
or MNAME LNAME
or FNAME LNAME, etc.
Oh and there is a forum for MS SQL:
http://www.daniweb.com/forums/forum127.html
FNAME LNAME
or MNAME LNAME
or FNAME LNAME, etc.
Oh and there is a forum for MS SQL:
http://www.daniweb.com/forums/forum127.html
Last edited by SheSaidImaPregy; Mar 5th, 2008 at 10:17 am.
•
•
Join Date: Jan 2008
Posts: 2,052
Reputation:
Solved Threads: 118
•
•
•
•
Scratch that! Use a predefined function called COALESCE. It's a life saver. Format:
COALESCE(columnname, 'valueifnull')
ASP.NET Syntax (Toggle Plain Text)
Select COALESCE(FNAME, '') +' '+ COALESCE(MNAME, '') +' '+ COALESCE(LNAME, '') as NAME from Cust_Master
Due to lack of freedom of speech, i no longer post on this website.
![]() |
Similar Threads
- Finding the nth row (SQL)...debative question (MS SQL)
- MySQL vs. SQL Server (PHP)
- SQL Server newbi... how to get started?? (MS SQL)
- Error in SQL Server 2005 (MS SQL)
- C# failing to drop stored procedure from SQL Server using SMO (C#)
- Enable only one user to edit a row in SQL server database using C#, asp.net win apps (ASP.NET)
- Need you suggestion for MS-SQL Server course (IT Professionals' Lounge)
- How to connect ASP with sql server ? (Community Introductions)
- SQL Server vs MYSQL vs MSQL (i'm stopping now) (MS SQL)
Other Threads in the ASP.NET Forum
- Previous Thread: how to make output cached page expire(refresh) before its duration completes
- Next Thread: Session in app_code
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formview gridview gudi iis javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl







