March 2, 2011 at 1:40 pm
select template_id, template_name, template_content, template_group, template_section,
delete_ind, application
from version5_ABCM..slxHRScreenTemplates
where template_group = 'ADMIN' or template_group = 'Corp Benefits' or template_group = 'Data Proc' or template_group = 'Smartlinx'
select template_id, template_name, template_content, template_group, template_section,
delete_ind, application
from version500..slxHRScreenTemplates
where template_group = 'ADMIN' or template_group = 'Manager' or template_group = 'Payroll' or template_group = 'HR'
Databases: version5_ABCM, version500
table: slxhrscreentemplates
columns: template_id, template_name, template_content, template_group, template_section,
delete_ind, application
assignment: I need to replace the information in version500..slxhrscreentemplates with the information in version5_ABCM..slxhrscreentemplates.
Keep in mind that template_content has XML, so XML has to be preserved.
March 2, 2011 at 2:01 pm
Welcome to sql server central.
Keep in mind that we can't see your screen from here. 😉
Are you trying to replace this data? Are you trying to append data? If we have a clear idea of what you are trying to do there are lots of people here willing to help.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 2, 2011 at 2:42 pm
I am trying to replace this data, meaning the data from version500 will be gone and replaced by the data from version5_ABCM.
March 2, 2011 at 3:19 pm
Can you just delete the existing data and then insert from the other table?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 2, 2011 at 3:21 pm
I could, but I prefer a stored procedure for it if there is one just to pass through the parameters.
March 2, 2011 at 3:28 pm
njdevils39 (3/2/2011)
I could, but I prefer a stored procedure for it if there is one just to pass through the parameters.
Not sure exactly what you mean but you can do this in a stored proc easily enough.
create procedure MyProcedure
as begin
delete version500..slxhrscreentemplates
where blah blah blah
insert version500..slxhrscreentemplates
select * from version5_ABCM..slxhrscreentemplates
where blah blah blah
end
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 2, 2011 at 3:30 pm
Or you could do an "update from" too. Not really sure what you are trying to do but there are lots of ways to do this.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
March 2, 2011 at 3:31 pm
What are the parameters though?
March 2, 2011 at 3:35 pm
Depends on what you need. Is this code you are trying to reuse? I have no idea what the business rules are or what the data looks like. Maybe TemplateGroup? The parameters will have to be based on what you are trying to do.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply