October 19, 2007 at 9:23 am
I have two tables
Table A
Table B
Both tables have the following four columns
School Code
School name
Grade
Year
i want to insert values from table B into table A
Table B has the following values in its columns
School Code School name Grade Year
24 abc 2 99
25 xyz 3 99
what i want is when i insert the above values from table B INTO table A it should be like below
School Code School name Grade Year
0024 abc 2 1999
0025 xyz 3 1999
October 19, 2007 at 9:27 am
This really isn't difficult. What have you tried so far?
John
October 19, 2007 at 9:42 am
can you guide me how to do this i am short of time and have no time to research .appreciate your help
October 19, 2007 at 9:43 am
October 19, 2007 at 10:02 am
What are the data types for these fields? Might not be possible.
October 19, 2007 at 10:09 am
Also, how are the tables defined (please post the DDL for the tables)?
October 19, 2007 at 10:19 am
And if we do end up doing this for you (again), let us know what grade we got, even though "it's not homework".
Actually, I take it back. I can't speak for anyone else, but you do this repeatedly, and if it's truly not homework (which I don't believe for a minute), then your unwillingness to put out the smallest bit of effort to learn the skills needed for your job should result in you being fired. So, I (again, speaking only for myself) am no longer going to help you in any way, shape, or form, unless you show that you've put at least some effort into resolving it via BOL.
I think it's time for you to man up a bit.
October 19, 2007 at 10:26 am
David, Actually well put. I just am curious if what he wants to do is doable.
October 19, 2007 at 10:37 am
i dont know why you guys created these forums if you dont want to help only bigh mouths .Any way i will get it myself you guys can only disgrace and you should be critic professor not developers,i think if you something you dont loose if you tell
October 19, 2007 at 10:46 am
Actually, all we are asking is that you try to solve your problems first. If you are having difficulties, show us what you have done and we will gladly help you from there. Every post you have created asking for help, you never show us what you have done or tried. It is like you expect us (members of SSC) to do your work (home or job) for you.
We can give you the fish and feed you for a day, or we can teach you to fish, in which case you can feed yourself for a lifetime. We'd prefer to teach you to fish.
😎
October 19, 2007 at 10:47 am
Best;
by simply clicking on your name and looking over your previous posts, it's obvious that the moment you encounter a question, you post it here first without ever attempting to look at it yourself.
By reading the context of the posts, it's also obvious you do not TRY the suggested solutions that are offered to you before commenting on them either. Yuo consistantly offer incomplete questions, and want users to second guess and backfill your requirements, and provide a complete solution to your question. That's not what the forums main purpose is...the purpose is more towards HELPING, not DOING it for you.
There is a HUGE difference between asking a blank newbie statement on how to do something,(without ever checking BOL or Google) and saying "i tried this , expected this and it didn't work as expected, can someone help"
Users here LOVE to help those who help themselves.
We tend to nudge newbies to learn to do a bit of research on their own before throwing up their hands.
Lowell
October 19, 2007 at 10:50 am
ok that is a good reply and i guess i understand wht is your point of view i will make sure i will follow it.
thanks
October 19, 2007 at 10:56 am
Best (10/19/2007)
I have two tablesTable A
Table B
Both tables have the following four columns
School Code
School name
Grade
Year
i want to insert values from table B into table A
Table B has the following values in its columns
School Code School name Grade Year
24 abc 2 99
25 xyz 3 99
what i want is when i insert the above values from table B INTO table A it should be like below
School Code School name Grade Year
0024 abc 2 1999
0025 xyz 3 1999
Hello Best,
It may not be the intension of the members to criticise something or disgrace someone but they are here to help you out with a better solution and advise if the complete information is available.
Like one of the members request you for the datatype of the column and one member asked as to if all the years are prior to 2000.
If you have the datatype of last column as varchar or something that supports string
you can straight away append '19' to it by
INSERT INTO TableA
SELECT [School Code ] ,[School name ] ,[Grade] , '19' + Year from TableB
Assuming all years are prior to 2000
And if the datatype is int or some numeric datatype then
INSERT INTO TableA
SELECT [School Code ] ,[School name ] ,[Grade] , CAST('19'+ CAST(Year AS VARCHAR(2)) AS INT)
from TableB
Let me know if you have any questions.
Prasad Bhogadi
www.inforaise.com
October 19, 2007 at 11:03 am
thanks for the help but from now i will try to help myself and find the solution and if i dont i will let you guys wht i have done so far before i post my question
October 19, 2007 at 11:47 am
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply