Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to SQL

Status
Not open for further replies.

UCF87

Technical User
Feb 13, 2003
44
0
0
US
The table name is ReportRules
The column names are rptTitle and rptRuleDescription
rptTitle and rptDecription have the same information. (rptTitle is the actual title the user sees and rptDescription is for the administrator for a quick reference in the software)

problem: Need to change part of both rptTitle and rptRuleDecription to a new title, but keeping the name and the report number the same. I have about 15 reports X 250 areas to change.

Example:

Athens - (0001) Statement of Revenues and Expenses
change to:
Athens - (0001) Detailed Statement of Income - Dept


Thanks in Advance.
 
From the subject line "New to SQL" and the post, I can't figure out what the question is. You have to change the Title for a lot of records, so...get to work!
-Karl

[red] Cursors, Triggers and User Definded Functions are part of the Axis of Evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Hi UCF87,

You can accomplish a change to the data contained within the rptTitle and rptRuleDescription through a simple update query.

Without a lot of information on where you're getting the information from to update the columns, I'll provide a general example of an update query.

Code:
declare @MyNewStr varchar(255)

select  @MyNewStr = "Detailed Statement of Income - Dept"

update  ReportRules
set     rptTitle = @MyNewStr,
        rptRuleDescription = @MyNewStr
where   <Some qualifier logic here>

Please post an update if you need additional assistance.

 
I think I about got it, but I am getting NULL index numbers.


DECLARE @COUNTCOL INT
DECLARE @NEWTITLE VARCHAR(50)
SELECT rptTitle, SUBSTRING(rptTitle, 1, @COUNTCOL)+ 'Detailed Statement of Income - Dept'
FROM ReportRules
WHERE (rptTitle LIKE N'%(0001)%')
ORDER BY rptTitle
SELECT @COUNTCOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top