OBJECT_ID (Transact-SQL) is database object identification number of a schema-scoped object.
Example, it will drop table test if the table test already exist in the database.
IF OBJECT_ID (N’dbo.test’, N’U') IS NOT NULL
DROP TABLE dbo.test;
GO
When SET QUOTED_IDENTIFIER ON, identifiers can be delimited by double quotation ” marks, and literals must be delimited by single quotation ‘ marks. However, when SET QUOTED_IDENTIFIER OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers. Hmm… So what this mean?
For example,
SET QUOTED_IDENTIFIER OFF
GO– You cannot use reserved keyword, it will fail
CREATE TABLE “select” (”identity” INT IDENTITY NOT NULL, “order” INT NOT NULL)
GOSET QUOTED_IDENTIFIER ON
GO– When is ON, you can use reserved keyword. It will pass.
CREATE TABLE “select” (”identity” INT IDENTITY NOT NULL, “order” INT NOT NULL)
GO
Another example,
SET QUOTED_IDENTIFIER OFF
GO– Literal strings can be in single or double quotation marks.
INSERT INTO dbo.Test VALUES (1, “‘Text in single quotes’”)
INSERT INTO dbo.Test VALUES (2, ‘”Text in double quotes”‘)
When SET ANSI_WARNINGS ON, warning message will be returned. On the other hand, SET ANSI_WARNINGS OFF will turn off the warning message.
I need to replace some of the words in the sentence. But how am I going to do so? Let’s say, I have this sentence as example.
I love to eat durian very much.
I want to replace the word “durian” with “apple”. Just follow below C# source code to replace it.
String sentence = “I love to eat durian very much.”;
sentence = sentence.Replace(”durian”, “apple”);
You will get the output like this…
I love to eat apple very much.
Based on the example above, just key in 2 parameters in String.Replace(”old value“, “new value“). The “new value” will replace “old value”.
Enjoy coding…