With out SQL identity column inserting the datas, via asp.net
-
Hi in sql, "identity column" will automatically increase the value of its own, wenever other columns getting the value. But in my case i have mentioned my column datatype as varchar, so "identity" wont work out here. i want to insert my datas like this format for my ID Column, ID V00000001 V00000002 V00000003 . . . V00000023 how to achieve using asp.net Thanks & Regards, Member 3879881, please don't forget to vote on the post
-
Hi in sql, "identity column" will automatically increase the value of its own, wenever other columns getting the value. But in my case i have mentioned my column datatype as varchar, so "identity" wont work out here. i want to insert my datas like this format for my ID Column, ID V00000001 V00000002 V00000003 . . . V00000023 how to achieve using asp.net Thanks & Regards, Member 3879881, please don't forget to vote on the post
If the data always begins with "V" I would use the idendity column and concatenate either in a calculated column or in my data/business layer to form the field. Otherwise, add an insert trigger to the table and use string functions to convert to a number, find the next in the sequence, then insert the column.
I know the language. I've read a book. - _Madmatt
-
Hi in sql, "identity column" will automatically increase the value of its own, wenever other columns getting the value. But in my case i have mentioned my column datatype as varchar, so "identity" wont work out here. i want to insert my datas like this format for my ID Column, ID V00000001 V00000002 V00000003 . . . V00000023 how to achieve using asp.net Thanks & Regards, Member 3879881, please don't forget to vote on the post
Before inserting, get the max Id number from your database, increment it by 1 (or your wish) and then insert a new record in the table using an incremented Id. You gona have to do some logic for the correct number of zeros to be put before the actuall number.
-
Hi in sql, "identity column" will automatically increase the value of its own, wenever other columns getting the value. But in my case i have mentioned my column datatype as varchar, so "identity" wont work out here. i want to insert my datas like this format for my ID Column, ID V00000001 V00000002 V00000003 . . . V00000023 how to achieve using asp.net Thanks & Regards, Member 3879881, please don't forget to vote on the post
For that, you have to do the following..... 1) First retrieve the max id from your database. 2) Then convert the number part of data i.e. 00000001 to int. 3) Then increment it. 4) According to the number, concatenate that number of 0's and V to the incremented number. 5) Insert this id to your database. 6) Enjoy! :thumbsup: