October 17, 2003 at 9:52 am
When creating a view, you state your selection criteria which can include character constants that are single quoted, such as 'ALL'.
In the openquery function, the link server is the first parameter and the query statement is the second parameter. The statement must be a character string which means single quotes.
How do you embed a quoted character constant in a qouted string, like the following:
'Select * from customer where state = 'AL''
Thanks.
October 17, 2003 at 10:38 am
Try This
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vw_test
AS
SELECT * FROM OPENQUERY(TEST,"Select * from customer where state = 'AL'")
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
October 20, 2003 at 2:37 am
You need to embed the quoted constants within another pair of single quotes:
CREATE VIEW dbo.vw_test
AS
SELECT * FROM OPENQUERY(TEST,'Select * from customer where state = ''AL'' ')
GO
Tony Bater
Tony
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy