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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server to access conversion issue

Status
Not open for further replies.

j252ewv

Programmer
Jul 2, 2008
43
GB
below is a sql query i run in sql server sucessfully, however in access the declare staements are the cause of errorrs can someone help me re-write this query to fix the issue.

Thanks in advance.

DECLARE @Result INT

DECLARE @Search VARCHAR(255)
DECLARE @Value VARCHAR(255)

set @Search = 'OciusUseCV2'
set @Value = 'True'

set @Result = (select count(*) from setting where UPPER([key]) = UPPER(@Search))

select @result

if @result = 0

INSERT INTO Setting
([User],Section,[Key],[Value])
VALUES
('SYSTEM','Settings',@Search,@Value)
 
INSERT INTO Setting ([User],Section,[Key],[Value])
SELECT DISTINCT 'SYSTEM','Settings','OciusUseCV2','True'
FROM anyTableYouWant
WHERE 0=(SELECT Count(*) FROM Setting WHERE [key]='OciusUseCV2')

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top