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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Doubt in max query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-08 : 08:06:13
rajkumar writes "I am using sql server back-end in my project. Now my question is how to find maxvalue in the following records.
1.U20046601
In this
u-->Id
2004-->year
6-->month
6-->day
01-->increment value
What i want is next time it will be incremented to U20046602.
how it is possible. Becuase i declared that field as a varchar not numeric"

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-06-08 : 08:11:04
The problem here is that you have tried to squeeze in too much data into one little column. If possible, you should redesign your table to store the individual bits in different columns, because the golden rule is "It's a hell lot easier to join strings than to split them"

If necessary, add a computed column in your table (or use a view) to get the concatenated output.

OS
Go to Top of Page
   

- Advertisement -