Click here to Skip to main content
15,395,065 members
Home / Discussions / Database
   

Database

 
QuestionOracle Connection User Name and Password [UPDATE] Pin
Kevin Marois30-Jan-15 11:24
professionalKevin Marois30-Jan-15 11:24 
Questionhow can i transfer data Pin
Member 1141305829-Jan-15 12:55
MemberMember 1141305829-Jan-15 12:55 
AnswerRe: how can i transfer data Pin
Mycroft Holmes29-Jan-15 13:41
professionalMycroft Holmes29-Jan-15 13:41 
GeneralRe: how can i transfer data Pin
Member 114130581-Feb-15 5:23
MemberMember 114130581-Feb-15 5:23 
AnswerRe: how can i transfer data Pin
Umer Akram29-Jan-15 18:52
MemberUmer Akram29-Jan-15 18:52 
GeneralRe: how can i transfer data Pin
Member 114130581-Feb-15 5:24
MemberMember 114130581-Feb-15 5:24 
GeneralRe: how can i transfer data Pin
Umer Akram3-Feb-15 18:43
MemberUmer Akram3-Feb-15 18:43 
QuestionModify the computed expression of computed column Pin
indian14327-Jan-15 6:41
Memberindian14327-Jan-15 6:41 
Hi All,

I have a database table which I want to modify the computed expression of a column, Computed expression of the column was as below
(case when [AnnualFederalPovertyLevel] IS NULL AND [MonthlyFederalPovertyLevel] IS NULL then (0) when [AnnualFederalPovertyLevel] IS NOT NULL AND [MonthlyFederalPovertyLevel] IS NULL then [AnnualFederalPovertyLevel] when [AnnualFederalPovertyLevel] IS NULL AND [MonthlyFederalPovertyLevel] IS NOT NULL then [MonthlyFederalPovertyLevel] when [UseMonthlyIncome] IS NOT NULL AND [UseMonthlyIncome]=(1) AND [AnnualFederalPovertyLevel]>[MonthlyFederalPovertyLevel] then [MonthlyFederalPovertyLevel] else [AnnualFederalPovertyLevel] end)


Now I want to change it to
(case when [AnnualFederalPovertyLevel] IS NULL AND [MonthlyFederalPovertyLevel] IS NULL then (0) 
	when [AnnualFederalPovertyLevel] IS NOT NULL AND [MonthlyFederalPovertyLevel] IS NULL then 
	(CASE WHEN [AnnualFederalPovertyLevel] > 0 THEN [AnnualFederalPovertyLevel] ELSE 0 END)
	when [AnnualFederalPovertyLevel] IS NULL AND [MonthlyFederalPovertyLevel] IS NOT NULL then 
	(CASE WHEN [MonthlyFederalPovertyLevel] > 0 THEN [MonthlyFederalPovertyLevel] ELSE 0 END) 
	when [UseMonthlyIncome] IS NOT NULL AND [UseMonthlyIncome]=(1) AND [AnnualFederalPovertyLevel]>[MonthlyFederalPovertyLevel] then 
	(CASE WHEN [MonthlyFederalPovertyLevel] > 0 THEN [MonthlyFederalPovertyLevel] ELSE 0 END) 
	else (CASE WHEN [AnnualFederalPovertyLevel] > 0 THEN [AnnualFederalPovertyLevel] ELSE 0 END) end)

I have tried in the below way, but it didn't work gave me the following error
ALTER TABLE dbo.ApplicationData DROP COLUMN ReportingFpl;
GO
ALTER TABLE dbo.ApplicationData ADD ReportingFpl AS (case when [AnnualFederalPovertyLevel] IS NULL AND [MonthlyFederalPovertyLevel] IS NULL then (0) 
	when [AnnualFederalPovertyLevel] IS NOT NULL AND [MonthlyFederalPovertyLevel] IS NULL then 
	(CASE WHEN [AnnualFederalPovertyLevel] > 0 THEN [AnnualFederalPovertyLevel] ELSE 0 END)
	when [AnnualFederalPovertyLevel] IS NULL AND [MonthlyFederalPovertyLevel] IS NOT NULL then 
	(CASE WHEN [MonthlyFederalPovertyLevel] > 0 THEN [MonthlyFederalPovertyLevel] ELSE 0 END) 
	when [UseMonthlyIncome] IS NOT NULL AND [UseMonthlyIncome]=(1) AND [AnnualFederalPovertyLevel]>[MonthlyFederalPovertyLevel] then 
	(CASE WHEN [MonthlyFederalPovertyLevel] > 0 THEN [MonthlyFederalPovertyLevel] ELSE 0 END) 
	else (CASE WHEN [AnnualFederalPovertyLevel] > 0 THEN [AnnualFederalPovertyLevel] ELSE 0 END) end);

Error
Msg 5074, Level 16, State 1, Line 3
The index 'IX_ApplicationData_ApplicationId-ReportingFpl_PriorityPoints-ContractorPriorityPoints' is dependent on column 'ReportingFpl'.
Msg 4922, Level 16, State 9, Line 3
ALTER TABLE DROP COLUMN ReportingFpl failed because one or more objects access this column.
Msg 2705, Level 16, State 5, Line 1
Column names in each table must be unique. Column name 'ReportingFpl' in table 'dbo.ApplicationData' is specified more than once.

Thanks & Regards,

Abdul Aleem Mohammad
St Louis MO - USA

AnswerRe: Modify the computed expression of computed column Pin
Richard Deeming27-Jan-15 7:02
mveRichard Deeming27-Jan-15 7:02 
AnswerRe: Modify the computed expression of computed column Pin
deepakdynamite28-Jan-15 0:27
Memberdeepakdynamite28-Jan-15 0:27 
QuestionBLOB or external storage... Pin
Kornfeld Eliyahu Peter26-Jan-15 20:57
professionalKornfeld Eliyahu Peter26-Jan-15 20:57 
AnswerRe: BLOB or external storage... Pin
den2k8826-Jan-15 21:32
professionalden2k8826-Jan-15 21:32 
AnswerRe: BLOB or external storage... Pin
GuyThiebaut26-Jan-15 21:48
professionalGuyThiebaut26-Jan-15 21:48 
AnswerRe: BLOB or external storage... Pin
Jörgen Andersson26-Jan-15 22:13
professionalJörgen Andersson26-Jan-15 22:13 
AnswerRe: BLOB or external storage... Pin
Richard Deeming27-Jan-15 1:50
mveRichard Deeming27-Jan-15 1:50 
GeneralRe: BLOB or external storage... Pin
Jörgen Andersson27-Jan-15 3:06
professionalJörgen Andersson27-Jan-15 3:06 
AnswerRe: BLOB or external storage... Pin
deepakdynamite28-Jan-15 0:30
Memberdeepakdynamite28-Jan-15 0:30 
QuestionDatediff function Pin
Ambertje26-Jan-15 2:18
MemberAmbertje26-Jan-15 2:18 
AnswerRe: Datediff function Pin
Chris Quinn26-Jan-15 2:25
MemberChris Quinn26-Jan-15 2:25 
GeneralRe: Datediff function Pin
Ambertje26-Jan-15 2:34
MemberAmbertje26-Jan-15 2:34 
GeneralRe: Datediff function Pin
Chris Quinn26-Jan-15 2:42
MemberChris Quinn26-Jan-15 2:42 
GeneralRe: Datediff function Pin
Ambertje26-Jan-15 3:12
MemberAmbertje26-Jan-15 3:12 
GeneralRe: Datediff function Pin
Chris Quinn26-Jan-15 3:18
MemberChris Quinn26-Jan-15 3:18 
GeneralRe: Datediff function Pin
Ambertje26-Jan-15 3:26
MemberAmbertje26-Jan-15 3:26 
GeneralRe: Datediff function Pin
Jörgen Andersson26-Jan-15 21:17
professionalJörgen Andersson26-Jan-15 21:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.