Click here to Skip to main content
15,902,447 members
Home / Discussions / Database
   

Database

 
GeneralRe: error in restore Pin
Vimalsoft(Pty) Ltd22-Dec-09 18:52
professionalVimalsoft(Pty) Ltd22-Dec-09 18:52 
Questionget encrypted passwords from sql using encryption string Pin
220821-Dec-09 17:21
220821-Dec-09 17:21 
AnswerRe: get encrypted passwords from sql using encryption string Pin
Jörgen Andersson21-Dec-09 21:19
professionalJörgen Andersson21-Dec-09 21:19 
Questionstored procedure for restore .bak file Pin
NarendraSinghJTV21-Dec-09 17:11
NarendraSinghJTV21-Dec-09 17:11 
AnswerRe: stored procedure for restore .bak file Pin
Vimalsoft(Pty) Ltd22-Dec-09 2:26
professionalVimalsoft(Pty) Ltd22-Dec-09 2:26 
QuestionHelp building Trigger for updating summary table [modified] Pin
MAW3021-Dec-09 11:29
MAW3021-Dec-09 11:29 
AnswerRe: Help building Trigger for updating summary table Pin
Mycroft Holmes21-Dec-09 23:56
professionalMycroft Holmes21-Dec-09 23:56 
Questiontransaction error Pin
ademsandeepreddy20-Dec-09 19:53
ademsandeepreddy20-Dec-09 19:53 
when i am executing the stored procedure by passing xml it is throwing transaction error

(1 row(s) affected)
Msg 266, Level 16, State 2, Procedure get_next_sequence, Line 0
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0.

(1 row(s) affected)

(1 row(s) affected)
Msg 3902, Level 16, State 1, Procedure sp_ProcessExcelSheet, Line 58
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

(1 row(s) affected)

stored procedure is here.

ALTER PROCEDURE [dbo].[sp_ProcessExcelSheet]
@file varchar (MAX)
AS
BEGIN
DECLARE @ComplaintDetail TABLE
(
ID int identity(1,1),
FName Varchar(50) not null,
Email Varchar(50),
Address Varchar(100) not null,
Disclose bit not null,
Complaint text not null,
Location varchar(50) not null,
Area varchar(50) not null,
PlaceFound varchar(50) not null,
ComplaintMode varchar(50) not null
)
DECLARE @idoc INT
EXEC sp_xml_preparedocument @idoc OUTPUT, @file
INSERT INTO @ComplaintDetail (FName,Email,Address,Disclose,Complaint,Location,Area,PlaceFound,ComplaintMode)
SELECT FName,Email,Address,Disclose,Complaint,Location,Area,PlaceFound,ComplaintMode
FROM OPENXML (@idoc, 'NewDataSet/Table',2)
WITH (FName Varchar(50),Email Varchar(50),Address Varchar(100),Disclose bit,Complaint text,
Location varchar(50),
Area varchar(50),
PlaceFound varchar(50),
ComplaintMode varchar(50))

declare @Count int
declare @IntCount int
set @IntCount=1
select @Count=count(*) from @ComplaintDetail
create table #Reff(FName varchar(50),Email varchar(50),ReffNo varchar(10) )
declare @FName Varchar(50)
declare @Email Varchar(50)
declare @Address Varchar(100)
declare @Disclose bit
declare @Complaint varchar(max)
declare @Location varchar(50)
declare @Area varchar(50)
declare @PlaceFound varchar(50)
declare @ComplaintMode varchar(50)
declare @seqno int
declare @sequentialNo varchar(10)
BEGIN TRAN T1
while(@IntCount<@Count+1)
begin
exec dbo.get_next_sequence @seqno output
set @sequentialNo= 'p'+convert(varchar(9),@seqno)
select @FName=FName,@Email=Email,@Address=Address,@Disclose=Disclose,@Complaint=Complaint,@Location=Location,@Area=Area,@PlaceFound=PlaceFound,@ComplaintMode=ComplaintMode from @ComplaintDetail where ID=@IntCount
Insert into HelpLine(ReferenceNo,FName,Email,Address,Disclose,Complaint,Location,Area,PlaceFound,ComplaintMode,ComplaintDate,ComplaintStatus)
values(@sequentialNo,@FName,@Email,@Address,@Disclose,@Complaint,@Location,@Area,@PlaceFound,@ComplaintMode,getdate(),'Open')
insert into #Reff values(@FName,@Email,@sequentialNo)
set @IntCount=@IntCount+1
end
IF @@ERROR = 0
COMMIT TRANSACTION T1
else
RollBack TRANSACTION T1
select * from #Reff
drop table #Reff
SET NOCOUNT ON;
END
when i changed the same same stored procedure it is throwing error as

Msg 2801, Level 16, State 1, Procedure sp_ProcessExcelSheet, Line 57
The definition of object 'sp_ProcessExcelSheet' has changed since it was compiled.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE [dbo].[sp_ProcessExcelSheet]
@file varchar (MAX)
AS
BEGIN
DECLARE @ComplaintDetail TABLE
(
ID int identity(1,1),
FName Varchar(50) not null,
Email Varchar(50),
Address Varchar(100) not null,
Disclose bit not null,
Complaint text not null,
Location varchar(50) not null,
Area varchar(50) not null,
PlaceFound varchar(50) not null,
ComplaintMode varchar(50) not null
)
DECLARE @idoc INT
EXEC sp_xml_preparedocument @idoc OUTPUT, @file
INSERT INTO @ComplaintDetail (FName,Email,Address,Disclose,Complaint,Location,Area,PlaceFound,ComplaintMode)
SELECT FName,Email,Address,Disclose,Complaint,Location,Area,PlaceFound,ComplaintMode
FROM OPENXML (@idoc, 'NewDataSet/Table',2)
WITH (FName Varchar(50),Email Varchar(50),Address Varchar(100),Disclose bit,Complaint text,
Location varchar(50),
Area varchar(50),
PlaceFound varchar(50),
ComplaintMode varchar(50))

declare @Count int
declare @IntCount int
set @IntCount=1
select @Count=count(*) from @ComplaintDetail
create table #Reff(FName varchar(50),Email varchar(50),ReffNo varchar(10) )
declare @FName Varchar(50)
declare @Email Varchar(50)
declare @Address Varchar(100)
declare @Disclose bit
declare @Complaint varchar(max)
declare @Location varchar(50)
declare @Area varchar(50)
declare @PlaceFound varchar(50)
declare @ComplaintMode varchar(50)
declare @seqno int
declare @sequentialNo varchar(10)
BEGIN TRAN T1
SET IMPLICIT_TRANSACTIONS ON
begin
while(@IntCount<@Count+1)
begin
exec dbo.get_next_sequence @seqno output
set @sequentialNo= 'p'+convert(varchar(9),@seqno)
select @FName=FName,@Email=Email,@Address=Address,@Disclose=Disclose,@Complaint=Complaint,@Location=Location,@Area=Area,@PlaceFound=PlaceFound,@ComplaintMode=ComplaintMode from @ComplaintDetail where ID=@IntCount
Insert into HelpLine(ReferenceNo,FName,Email,Address,Disclose,Complaint,Location,Area,PlaceFound,ComplaintMode,ComplaintDate,ComplaintStatus)
values(@sequentialNo,@FName,@Email,@Address,@Disclose,@Complaint,@Location,@Area,@PlaceFound,@ComplaintMode,getdate(),'Open')
insert into #Reff values(@FName,@Email,@sequentialNo)
IF @@ERROR <> 0
RollBack TRANSACTION T1
set @IntCount=@IntCount+1
end
select * from #Reff
END
COMMIT TRANSACTION T1

drop table #Reff
SET NOCOUNT ON;
END



can any body help me regarding this

hi

AnswerRe: transaction error Pin
Member 450194023-Dec-09 7:31
Member 450194023-Dec-09 7:31 
QuestionNeed help with creating dynamic SQL statement Pin
James Shao20-Dec-09 17:54
James Shao20-Dec-09 17:54 
AnswerRe: Need help with creating dynamic SQL statement Pin
Mycroft Holmes21-Dec-09 11:00
professionalMycroft Holmes21-Dec-09 11:00 
QuestionNeed help with DATEDIFF function Pin
James Shao20-Dec-09 17:29
James Shao20-Dec-09 17:29 
AnswerRe: Need help with DATEDIFF function Pin
Ashfield21-Dec-09 0:27
Ashfield21-Dec-09 0:27 
GeneralRe: Need help with DATEDIFF function Pin
James Shao21-Dec-09 13:33
James Shao21-Dec-09 13:33 
Questioncannot excute script Pin
#Jet19-Dec-09 16:17
#Jet19-Dec-09 16:17 
AnswerRe: cannot excute script Pin
Eddy Vluggen20-Dec-09 0:08
professionalEddy Vluggen20-Dec-09 0:08 
GeneralRe: cannot excute script Pin
#Jet20-Dec-09 7:37
#Jet20-Dec-09 7:37 
GeneralRe: cannot excute script Pin
Mycroft Holmes20-Dec-09 12:14
professionalMycroft Holmes20-Dec-09 12:14 
GeneralRe: cannot excute script Pin
#Jet20-Dec-09 12:52
#Jet20-Dec-09 12:52 
QuestionDistributed DB Pin
piotr.zielinski19-Dec-09 7:55
piotr.zielinski19-Dec-09 7:55 
AnswerRe: Distributed DB Pin
Eddy Vluggen19-Dec-09 10:20
professionalEddy Vluggen19-Dec-09 10:20 
GeneralRe: Distributed DB Pin
piotr.zielinski19-Dec-09 10:24
piotr.zielinski19-Dec-09 10:24 
GeneralRe: Distributed DB Pin
Eddy Vluggen19-Dec-09 10:56
professionalEddy Vluggen19-Dec-09 10:56 
QuestionHow do I make a transaction an "atomic" operation? (SQL Server 2005) [modified] Pin
Xiangyang Liu 刘向阳18-Dec-09 2:28
Xiangyang Liu 刘向阳18-Dec-09 2:28 
AnswerRe: How do I make a transaction an "atomic" operation? (SQL Server 2005) Pin
Chris Meech18-Dec-09 2:46
Chris Meech18-Dec-09 2:46 

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.