473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to update set some added string

i have tblPeribadi as table of database
i want to add some string to each row for column kod_pusat_kos
maybe like this..
Expand|Select|Wrap|Line Numbers
  1. UPDATE tblPeribadi SET Kod_Pusat_Kos='00'+Kod_Pusat_Kos WHERE Kod_Pusat_Kos>10000001
Nov 11 '08 #1
5 2307
ck9663
2,878 Expert 2GB
what's the data type of kod_pusat_kos ?


-- CK
Nov 11 '08 #2
kod_pusat_kos char(10)
Nov 11 '08 #3
amitpatel66
2,367 Expert 2GB
Yes you can concatenate the data to the existing value of the column but that should not exceed 10 Characters
Nov 11 '08 #4
ck9663
2,878 Expert 2GB
If you're considering of left-padding your column with zeros, consider this:


Expand|Select|Wrap|Line Numbers
  1.  
  2. UPDATE tblPeribadi 
  3. SET Kod_Pusat_Kos=right('0000000000'+Kod_Pusat_Kos,10)
  4. WHERE cast(Kod_Pusat_Kos as int) >10000001
  5.  
  6.  
Happy coding!

-- CK
Nov 11 '08 #5
If you're considering of left-padding your column with zeros, consider this:


Expand|Select|Wrap|Line Numbers
  1.  
  2. UPDATE tblPeribadi 
  3. SET Kod_Pusat_Kos=right('0000000000'+Kod_Pusat_Kos,10)
  4. WHERE cast(Kod_Pusat_Kos as int) >10000001
  5.  
  6.  
Happy coding!

-- CK
Thanks CK and i did it with LEFT
Nov 17 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
1
by: Bennett Haselton | last post by:
Suppose I add a new row to a table in a dataset, and then I use an OleDbDataAdapter to add that new row to a SQL Server database using OleDbDataAdapter.Update(), as in the following code: ...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
0
by: sdash | last post by:
I'm working on a simple formview screen that should update a SQL Server 2000 record. I'm sure there must be something simple wrong, but when I press update, the screen refreshes and the changes...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
5
by: explode | last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As String) that creates a new oledbDataAdapter with insert update select and delete commads. I also added that commands can...
4
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters...
0
by: tdes42 | last post by:
Hi :) I have been banging away at this patchwork piece of code for some time... I'm trying to create a button that will disable after it is successfully used to add records to table1, but on a...
1
beacon
by: beacon | last post by:
Hi everybody, I have an Employee table with the following: Table - Employee -------------------------- ID: AutoNum, PK FName: Text LName: Text Status: Yes/No
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.