Translate

Software / Web developers quiz

Quiz 1: How to remove extra spaces (keep one space between two words) from string in C#?

Answer:

        string sString = "we are      software   developers who do not         compromise with quality";
        sString = sString.Replace(" ", "{}");
        sString = sString.Replace("}{", string.Empty);
        sString = sString.Replace("{}", " ");

Output: we are software developers who do not compromise with quality



Quiz 2: How to remove extra spaces (keep one space between two words) from string in SQL Server?

Answer:

DECLARE @vc_content varchar(100)

SET @vc_content = 'My    passion        is software development   in     asp.net'

SET @vc_content = REPLACE(@vc_content, ' ', '[]')
SET @vc_content = REPLACE(@vc_content, '][', '')
SET @vc_content = REPLACE(@vc_content, '[]', ' ')

SELECT @vc_content AS vc_content


Output: My passion is software development in asp.net


Quiz 3: How to check all constraints of a table using command in SQL Server??

Answer:

To check all constraints of a table use following command:

SP_HELPCONSTRAINT <Table Name>

EX: SP_HELPCONSTRAINT Employee


No comments:

Post a Comment