Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query-sql

Author  Topic 

Gayatri D.Patil
Yak Posting Veteran

58 Posts

Posted - 2008-01-02 : 01:37:30
hello sir
this is my mssql query--------

SELECT LastName+''+ LEFT(FirstName, 3)UserID, LastName as Password from tUser

output= UserId
Pandey Ja
But i want output like this===
UserId
PandeyJa
pls help me urgently.
gayatri

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-02 : 01:39:36
SELECT LastName + LEFT(FirstName, 3)UserID, LastName as Password from tUser
Go to Top of Page

Gayatri D.Patil
Yak Posting Veteran

58 Posts

Posted - 2008-01-02 : 01:48:28
sir
i run your query but again same output.
i don't want a space between
Pandey Ja
pls help me.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-02 : 01:50:15
try

SELECT rtrim(LastName) + LEFT(FirstName, 3)UserID, LastName as Password from tUser



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Gayatri D.Patil
Yak Posting Veteran

58 Posts

Posted - 2008-01-02 : 01:54:02
sir
i run your query but output is same so pls help me.

this is mssql query--------

SELECT rtrim(LastName) + LEFT(FirstName, 3)UserID, LastName as Password from tUser

output= UserId
Pandey Ja

But i want output like this===

UserId
PandeyJa

pls help me urgently.
gayatri
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-02 : 01:55:59
try use ltrim() on the FirstName also


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Gayatri D.Patil
Yak Posting Veteran

58 Posts

Posted - 2008-01-02 : 02:08:37
thanku very much
its run.
thanks again.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-02 : 03:20:05
quote:
Originally posted by Gayatri D.Patil

sir
i run your query but output is same so pls help me.

this is mssql query--------

SELECT rtrim(LastName) + LEFT(FirstName, 3)UserID, LastName as Password from tUser

output= UserId
Pandey Ja

But i want output like this===

UserId
PandeyJa

pls help me urgently.
gayatri



Always use the keyword AS before alias name
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/14/should-alias-names-be-preceded-by-as.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -