Skip to content
Advertisement

Tag: sql-server-2008

Can I SELECT all the bult-in functions in SQL Server?

Is it possible to display every built-in function (like LEFT, SIN, IIF etc.) with a query? Answer Documentation or syntax highlighting definition from official tool: Azure Data Studio – syntax support Searching for: “name”: “support.function Idea – Not tested: Maybe it is possible to extract that data from system database – Resource Resource Database The Resource database is a read-only

Fetching Database Name with Space

Thanks for looking into my post. I am trying to run a query across all the database in SQL Server but the cursor is not fetching if the database contains space and the database is online. Code Error Answer Delimit Identify your object’s name. In normal terms that would be wrapping it with brackets ([]), however, as this appears to

Get Row value as Column Header

I have two tables as below. I want to join these two tables and need to set the column values of second table as column header as shown below. How can I achieve this? Table1  table2 The output table should be Answer You can use Dynamic Pivot as below-

setting time range in SQL Developer

I am working on a dataset that contains car accidents and their time of occurrence. (the data set exists in SQL Server under the name accident). I have a column that is in date format. I would like to extract the time from the column. Then add a new column called lightining_period label the time as daytime or nighttime. My

Repeat insert statement without GO

Is there a “nicer” way to achieve the same results as this SQL query: Which is to insert 300 default all NULL (except PK Id col) new lines into an empty table? It seems to take a while! Also, the value 300 could be completely variable e.g. something like but that obviously doesn’t work: Answer You can use a recursive

Must declare scalar variable in a unit test

I am trying to design a unit test that ensures that a message is bigger than a certain number of characters. My code is: I am getting the following errors: Msg 137, Level 15, State 2, Procedure test that API_GetStandardDisclaimerText tests to make sure that the message is long enough, Line 25 [Batch Start Line 3] Must declare the scalar

Advertisement