you are provided with the single table having say 4 col ie
fname lname age city , now the all records with displying of
only fname and lname is required but in this format say my
name is abhay khanna it will come like this
abhay-khanna
rahul-roy
gaurav-singh
the above format is required

Answers were Sorted based on User's Feedback



you are provided with the single table having say 4 col ie fname lname age city , now the all recor..

Answer / monal

TRY THIS:
SELECT FIRSTNAME +'-'+LASTNAME FROM 'TABLENAME'

Is This Answer Correct ?    7 Yes 1 No

you are provided with the single table having say 4 col ie fname lname age city , now the all recor..

Answer / sudhakar

use replace function
select replace(a,' ','-') from sub_string

Is This Answer Correct ?    1 Yes 1 No

you are provided with the single table having say 4 col ie fname lname age city , now the all recor..

Answer / radhakrishnan

select replace('radha krishnan',' ','-')

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SQL Server Interview Questions

what are constraints? : Sql server database administration

0 Answers  


Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

0 Answers  


Can we perform backup restore operation on tempdb? : sql server database administration

0 Answers  


How to list all tables in the database using odbc_tables()?

0 Answers  


explain different types of jions with examples briefly?

3 Answers   Zensar,






How to write query to Delete the records in child table and corresponding records in parent table

11 Answers   Semantic Space,


Hi All, I want to display all duplicate records in the table. My query has to fetch all the records which are duplicate(First Name or Last Name). Also I want the ability to also pull names where there might be a middle initial placed in the end of the first name field, (i.e., "Maria Z. " vs. "Maria") as well. Please guide me to find this. Table: ID FirstName LastName 1 Zach H Hoffman 2 Zach Hoffman 3 Troy Hoffman 4 Shawn Livermore 5 Prem S 6 Jony Hoffman H 7 Zach Modan I need the query to filter......... ID FirstName LastName 1 Zach H Hoffman 2 Zach Hoffman 3 Troy Hoffman 6 Jony Hoffman H 7 Zach Modan I hope this example will give you clear idea..... Thanks in Advance Prem

2 Answers  


Consider a table with 8 rows 4 rows contains value 0 and 4 rows contains value 1.Now write a single update query to make all 0's as 1 and all 1's as 0

7 Answers   PMAM IT Services, TCS,


Give main differences between "Truncate" and "Delete".

0 Answers   HCL,


What are the different SQL Server Versions you have worked on?

0 Answers  


How to drop an existing table with "drop table" statements in ms sql server?

0 Answers  


What is transaction server isolation?

0 Answers  


Categories