For a while, I have been thinking about using my Stack Overflow answers (and answers on other sites on the Stack Exchange Network), and storing a copy of them here, on my blog as well. All posts on the Stack Exchange network are covered under the Creative …
Question I have the following SQL Server table :
create table Account( -- column names with their data types and properties Id int not null identity primary key, User varchar(50) not null, Job varchar(200) not null, -- table limitations constraint …
Question I have created a stored procedure which takes as inputs a schema name and a table name and outputs an INT containing the largest value in the id column of the table. I have also created a view containing all the schema names, table names, and primary …
Question I need to get the values from a Excel Sheet (in a shared folder) to export it and then create a SQL Table in my instance. After of this I will execute a Stored Procedure (I already created) in order to create extended properties for a specific schema …
Question I have 2 tables(source and destination) which are respectively NOR_LABOR and ALL_LABOR_DETAILS. In the source table(NOR_LABOR) there is a column feet_produced with the data type nchar(10). In the destination table(ALL_LABOR_DETAILS) there’s a column …
Question I’m trying to make CTE to count blocking sessions on server. Currently I made a function to do so(returns blocking session amount). But still could not write this query with CTE.
CREATE FUNCTION dbo.SESSIONS(@SESSION int) RETURNS INT AS BEGIN DECLARE …
Question I am wondering if it is possible to split up a very large query to have parts of it done on the secondary read only servers, or If this feature only allows me to run separate queries or scripts on the secondary servers. I would also like to know if …
Question I have 4 tables with dates to which I want to join to a date dimension table but it is returning many duplicates with left joins.
Tables are basically a date field which I want to count.
mdate datetime, mordate varchar(10),fteam varchar(20) sdate …
Question Imagine we have two nodes participating in SQL 2012 AO. This is a test instance. During one of the index rebuild operation the log was grown up really big (250 GB). We are unable to back it up due to space constraint. What if we backup the Tlog to …
Question I have a database which is in always-on high availability mode synchronized with another database on a different instance. How can I restore from a .bak file into the primary database using T-SQL?
I’m new to high availability and I’ve been advised …