SEARCH YOUR SOLUTION HERE  

ID increments by one with current year in front of it.

I am trying to have a auto generated ID field updating by one count with each new record. That part I can do. However I need to put the current year in front of it. I would like to have it in this format. Year-00001 I.E. 2004-00001 would be the first record. Is this possible with SQL Server 2000 Any help would be appreciated .



Posted On: Tuesday 20th of November 2012 03:04:26 AM Total Views:  330
View Complete with Replies




Related Messages:

DataGrid + images??   (135 Views)
!I'm just wondering weather the DataGrid control can include .jpg files or somethingI'd like to create a forum, very basic one, where I've got users with profiles (This far, this good), though,.. I'd like some idea on how I can make every posted message be followed or begin with the Users uploaded photo. WHould be great if anyone had any clue on howto manage such a thing..I'm using Access as a database.
Syntax errors in code that used to work (convert, multi-part identifier)   (217 Views)
I'm working on a project with a friend, we both have sql server 2005 installed. The problem is, some functions and procedures he wrote that worked fine on his installation, showed syntax errors on mine. (e.g. containing TOP instruction - after removing TOP they worked fine). I don't know what's going on and how to fix it. Could anyone help me please
All I want for the Holidays...   (165 Views)
The feeling of the holiday season is in the air: people are whistling, the birds are migrating, and Old Jack Frost has decided to pay a visit once more. Of course, when youre in South Florida, that means that the air outside has dropped to a nippy 22 degrees Celsius, that is. Yes, the sweater inducing room temperature is almost too much for us Floridians to handle, but we get through. When it gets this nice and cool, one cant help but be happy, think about music, love, and look nostalgically back at sitting down in front of a warm glow, taking in some of those wonderful holiday treats: Cookies, Cocoa, and HotJava. In fact, this time of year makes me think of that wonderful holiday classic, The Night Santa Went Crazy, by the masterful Al Yankovick; its what I like listening to on the long drives from Ft. Lauderdale to the frozen tundra of Tampa, FL, where my family takes residence. Its always interesting to pull up next to the house and see them there, enjoying the weather next to their Igloo. Holiday traveling: theres nothing in the world like it. Of course, the feeling of the holiday season isnt just about temperatures, travels, and things remembered. To a great many of us, this is the season for giving kind of like celebrating a month long birthday party. Of course, we here at Developer Shed are always in the giving spirit towards our readers, which is why this month were giving away a FREE Sound Blaster MP3+ USB External Sound Card. Thats right, folks, you no longer have to sit through those long flights and drives with nothing more than the crappy sound card your laptop or PDA came with. This nice little item allows you to have high quality sound in even the most aurally challenged portable devices. This is truly a highly deed item, by man and beast alike! But how, pray tell, do you enter this months giveaway The rules are simple: 1) Write and submit an article to norbert@developershed.com, with the subject "Developer Shed MP3+ Contest" for publication in any of our websites and win this awesome device, featured in an upcoming review. (Don't worry. The review was written before our marketing monks came up with the contest, so the review's content has not been affected.) The article, a tutorial, hardware review, tech-oriented personal experience tale, or news-worthy report on a tech related field (no corporate business coverage of X, Inc. is suing Y.com, please), must be about one of the topics covered on one of the following websites: Dev Shed, ASP Free, Dev Articles, Dev Hardware, and SEO Chat. This pretty much covers all aspects of development and todays technology. The article must be at least 1500 words in length, subdivided into at least 5 pages of information. (Check out http://www.devhardware.com/hardware/how-to/809,1/ for an example of what were looking for.) 2) The Contest runs until December 31, 2003, so your article must be in by that time. Articles may be submitted in the following formats: DOC, SWX, RTF, TXT, and HTML (please do not use the Save as HTML function in MS Word or Star Office). If there are images in the story, please send them in a .ZIP file containing both the pictures and the article. Articles (and inquiries) should be sent to norbert@developershed.com, with the subject "Developer Shed Contest Entry." 3) Judging will look at subject matter, quality of content (so make it interesting), and grammar. In fact, chances are that if we have to edit it, you ain't winning. It might still be published, so not all is lost! You may yet still have the chance at the fame and geek chic that comes with having your writings read by millions worldwide. I don't want to have to spend three days correcting grammatical mistakes, though - I'm not your English teacher, daing it! By submitting an article you agree to give Developer Shed exclusive publication rights to the story. the credit for genius, however, will stay with you, so no worries about my placing our grubby little name on the story and claiming that its our brainchild. The winner will be announced on the website and via phone call, or e-mail, or IM which ever is easiest to reach him/her at. Start your typing!!! Gnorb P.S. Check this posting once in a while in case there's something which needs to be changed in the contest rules.
SIMPLE open, write, close example anyone?   (153 Views)
SIMPLE open, write, close example anyone Hi - just wondering if anyone had a SIMPLE example of html page with asp code opening, getting name, writing name, close I need a SQL (not Access example). It would be much appreciated.
Help Please - Microsoft OLE DB Provider for SQL Server error '80040e21'   (215 Views)
Hi I had to switch one website from access db to sql and i had many errors all over the site but managed to fix them one way or another but this erro i cant fix. Microsoft OLE DB Provider for SQL Server error '80040e21' The requested properties cannot be supported. /apartments_for_rent_in_bulgaria_bansko/forum.asp, line 127 The error is generated when it trys to open a recordset. Here is the code of the recordset. Code: I am new to sql and dont know much of the syntax differenties between the access and sql so please i will appriciate if anyone helps me fix that.
Can't create autogenerate sequence id like e001   (305 Views)
friends , [highlight="I m using ASP.NET with C# 2005 and SQL SERVER 2005 for the ASP.Net Website."][/highlight] I m using sqldatasource to connect and retrieve the data from database and then it displays the data in the gridview on the button click event.I have created the stored procedure for insert,update and select query. I want to create the autogenerate id which is in sequence like :: Suppose for example i have employee table where there is employee id then i like to create the id as follows :: e001 or e01 or e1........e999 I have created employee id as the identity which increments the value of it everytime to + 1. But i don't know how to use or add 'e' employee_id INT (4) IDENTITY=YES + 1 I think it can be done thru substring function.But don't have much idea how it can be implemented ... If i take id field as char then it's impossible to auto increment the id to +1 . If anyone had solution or answer then please reply... Thanxs in advance ...
Spid auto clearing time   (188 Views)
everybody, We tries to connect to the database, a new process (SPID) is created. Even when we close all connections properly, the SPID remains and it is automatically cleared after some time locally. On our hosting server we see that the SPIDs are not cleared for quite long time. any SPs/functions idea on finding out the clearing time
Microsoft SQL Server: Error 208 - Invalid Object Name   (114 Views)
Hi I ahve a stored procedure reprting all call log's...When i execute the procedure wiht query analyser i get the error... Microsoft SQL Server: Error 208 - Invalid Object Name Invalid object name "table name" Will be grateful if someone can help me..
Anyway to Reset identity back to start value?   (213 Views)
I have a table in which the primary key is an id starting from 1 and incremented by 1 each time. So it goes 1,2, Now for testing, I delete info from the table and say if I delete record 1 the next record added has id as 2 and not 1. Anyway to reset this without creating the tables all over again
Displaying multiple results in one row   (220 Views)
Here's what my table looks like (1st Table) ID | Name -- |------ 1 | violato 2 | Steve (2nd Table) ID | Hobby ---|------ 1 | Basket 1 | Pool 1 | Soccer 2 | Tennis 2 | Golf And I want it to be displayed as: ID | Name | Hobby ---|------|-------------------- 1 |Violato|Basket, Pool, Soccer ---|------|-------------------- 2 |Steve |Tennis, Golf ------------------------------- So basically put all my hobbies in one column separated by , instead of one row on every hobby and duplicate all my name over and over again. I DO understand this can be done with MySQL by using GROUP_CONCAT() BUT i'm using MS SQL and I've been trying couple hours to fix it. This is an ASP.NET application is built on VB.NET using dataset and datatable if that matters.
probs getting data in datagrid to load   (461 Views)
hi. i am new to sql databases and am currently trying to get the table to populate with data from the database cnCMS. I have been following the ADO.NET step by step text but, when i compile, i keep getting a blank page. below is the method I am using for when the page loads. any ideas what i might be doing wrong any suggestion much appreciated. thanks in advance. Code: privatevoid BindDataGrid() { string sqlQuery = "SELECT AccountID, UserName, Password, " + "Email, ModifiedDate, CreationDate FROM Account"; cnCMSNET.Open(); SqlDataAdapter daAccount = new SqlDataAdapter(sqlQuery, cnCMS); daAccount.Fill(dsMaster2, "Account"); DataGrid1.DataSource = dsMaster2.Tables["Account"].DefaultView; DataGrid1.DataBind(); cnCMSNET.Close(); }
TOP 10 Incidents HELP   (112 Views)
HI all .. I am trying to create a query that retrived the top ten incidents in specific terms. The problem is that i can't get the top 10s. [ The most 10 common incidents ] i know that i have to use max but i don't know how to get the only 10 results of that query. Select column_1, max(column_2) from table1 group by column_1 Please help with this..
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'   (275 Views)
I am trying to update a table but unfortunately i see the following error: Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '('. /Sales/RS/rs_display_po_am.asp, line 192 from the code below. Not sure why it is playing up Sub ScomInsertSOCust(psinvadd, psdeladd, psackadd) set comInsertSOCust = Server.CreateObject("ADODB.Command") comInsertSOCust.ActiveConnection = MM_conn_to_EFACs_STRING_ap comInsertSOCust.CommandText = "UPDATE dbo.salesorders (scustadd, sdeladd, sackadd) VALUES ('"& psinvadd &"', '"& psdeladd &"', '"& psackadd &"')" comInsertSOCust.CommandType = 1 comInsertSOCust.CommandTimeout = 0 comInsertSOCust.Prepared = true comInsertSOCust.Execute() End Sub
Microsoft OLE DB Provider for ODBC Drivers error '80004005'   (235 Views)
I received an error message that I can't seem to resolve. The following: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Text Driver] Query must have at least one destination field. /process1.asp, line 16 Any assistance with the above will be greatly appreciated.
Concatenate two columns into one?   (184 Views)
How to concatenate two columns into a new column in SQL Server 2000 For example: Column1: Hong Column2: Kong then I would like Column3 to have 'Hong Kong' auto populated. Note: I want the syntax in the 'Formula' field in Enterprise Manager, not stored procedures. Does anyone know
Comma delimited string in nvarchar, matching with user id   (277 Views)
Okay heres the deal (I hope I can explain this clearly enough while being as breif as I can): I created a trouble ticket system (ASP site using MS SQL) where the trouble tickets were assigned to only one person, but now I need tickets to be assigned to multiple people. So in my ticket table I changed the assigned_to field to nvarchar and the user id's are comma delimited. On the users home page, when they sign into the site I show currently open tickets assigned to that user. Initially my SQL statement looked like this: strSQL = "SELECT t.ticket_id as [Ticket ID], t.priority, t.subject, b.name as [Client] FROM tickets t, users u, business b where u.user_id = t.assigned_to and t.assigned_to = "& session("user_id")&" and t.status = 'In Progress' and b.business_id = t.business_id" Now as the field type has changed I went looking for something to help me sort thru the comma delimited field to find tickets assigned to the logged in user and am somewhat close with this: strSQL = "SELECT t.ticket_id as [Ticket ID], t.priority, t.subject, b.name as [Client] FROM tickets t, users u, business b where u.user_id = t.assigned_to and (CHARINDEX(',"& session("user_id") &",',t.assigned_to)>0 OR CHARINDEX('"& session("user_id") &",',t.assigned_to)=1 OR CHARINDEX(',"& session("user_id") &"',t.assigned_to)=LEN(t.assigned_to)-1) and t.status = 'In Progress' and b.business_id = t.business_id order by b.name, t.ticket_id" or strSQL = "SELECT t.ticket_id as [Ticket ID], t.priority, t.subject, b.name as [Client] FROM tickets t, users u, business b where u.user_id = "& session("user_id") &" and (PATINDEX('%,"& session("user_id") &",%',t.assigned_to)>0 OR PATINDEX('%"& session("user_id") &",%',t.assigned_to)=1 OR PATINDEX('%,"& session("user_id") &"%',t.assigned_to)=LEN(t.assigned_to)-1) and t.status = 'In Progress' and b.business_id = t.business_id order by b.name, t.ticket_id" neither of which work that well as it will return records that aren't assigned to that user at all and I am nto sure why. I just found charindex() and patindex() and barely know how to use them properly. Please help me as I am at my wits end.
Is that possible to delete the SA userid   (188 Views)
in sql server how about if i created another administrator level id, and delete this one
Microsoft OLE DB provider for SQL Server not available   (154 Views)
I have just written screeds to explain this very frustrating problem and the system didn't accept my login so here goes again. I am using codecharge studio to develop a web application and am having huge problems with making a connection to an SQL database. The problem occurs with the connection string builder. I have tried other providers e.g. to an Access database and they all work. The provider causing grief is Microsft OLE DB Provider for SQL Server. the error message is that the provider is no longer available. I ran the DEPENDS utility and it would appear to be related to a file called MSDART.DLL, which caused me a heap of grief the other night and I thought I had resolved it by reinstallind MDAC 2.8 but this is not the case. I cannot afford to do a total system reinstall as I simply do not have the time and I will end up losing a heap of work so need to resolve it some other method. I am desperate to get it solved as I have the opportunity of doing a contract which will give some much needed funds as I have been without income for over 8 weeks as well. Cheers Lesley
How to Remove a Validation   (135 Views)
I converted a database from Access to SQL Server. the Default value for one field in the access database was set to >0. Now the the database is SQL Server and I do not know how to change the >0 setting for one field in one of the tables. There is no default value in SQL server for this field. There is no indexes for this field either. The error I am getting in the program is "The Value Entered is Prohibited by the Validation Rule set for field schMCHNBR." How do I change the Validation Rule to allow nothing to be selected. I tried checking allow nulls and this did not work either.
Invalid object name with SQL db   (257 Views)
Moved a SQL database to another server and now the website gives the following error. Microsoft OLE DB Provider for ODBC Drivers error '80040e37' [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'active_users'. /activeusers.asp, line 10 Just changed the DSN to reflect teh new server and added the db to the new machine and setup the user as dbo. Can't see why this happens, if I point the DSN to the old server it works fine. These are the lines the error references: 9 = StrSql = "DELETE FROM active_users WHERE Last_Seen < '" & StrOnlineTimedout & "'" 10 = conn.execute (StrSql) Any ideas on why this happens I've gotten nowhere with it