Click here to Skip to main content
12,444,287 members (50,027 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL-Server SQL-Server-2008 , +
I converted my sqlite file to sql server db. After that I added new columns to the sql server db tables. but I need to populate those column with the values from the already created sqlite column values. How can I do that? My sqlite table have columns versionId and versionName. My converted sql db have the same columns and one extra column named CompleteVer. I need to insert that column value from the exixting column values. now it is filled with NULL. What can I do.. Please help.
Posted 6-Sep-12 3:33am
Updated 6-Sep-12 3:42am
Wes Aday104.2K
v2
Comments
Wes Aday 6-Sep-12 9:43am
   
Corrected spelling, grammar, capitalization and removed rudeness.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

We can't really help - we have no idea what Version information you want to insert.
However, there are two ways to do this:

When you add the new column, remove the "Allow Null" condition, and provide a default value. All existing columns will then be given the default, rather than a null value.

If you can work out from other information what Version value you should use, then write a quick app to generate it for all null entries. We can't really help you do that, because we have no information as to where you would get it from!
  Permalink  
Comments
Manjuvijayan 6-Sep-12 9:53am
   
the CompleteVer column need to fill with the Value which taken from both versionId and VersionName field.(CompleteVer=versionId+VersionName)
OriginalGriff 6-Sep-12 10:06am
   
If you have that information already in two fields, why would you want to waste DB space when you can generate it very simply at any time?
SELECT id, name, id + name AS Version FROM myTable
Manjuvijayan 6-Sep-12 10:11am
   
I'm using c# code for converting sqlite to sq l server and table is created dynamically. can i add the extra column value dynamically? I'm fresher to this field...
OriginalGriff 6-Sep-12 11:43am
   
Presumably, if you are transferring the values via c# code, you can do it at that point?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 6 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100