| | |
SQL Server Question...
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
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 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# cac checkbox class commonfunctions confirmationcodegeneration contenttype countryselector css dataaccesslayer database datagrid datagridview datagridviewcheckbox deployment development dgv dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal forms formview gridview gudi iframe iis javascript jquery listbox menu microsoft mouse mssql multistepregistration nameisnotdeclared news objects opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail rotatepage schoolproject security serializesmo.table sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visualstudio web webapplications webarchitecture webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers







