Microsoft SQL Server





Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

Share tech news, updates, or what's on your mind.

Sign up to Post

I think the title states it all. Can this be done? Using -verbose captures output from SELECT, PRINT and RAISERROR statements to the console but I can't seem to also get them into the transcript file within a PowerShell script.
I know I can capture the output from SELECT statements into a variable, but that does not help with RAISERROR or PRINT statements.
On Demand Webinar: Networking for the Cloud Era
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Dear All

We have some servers physical and Virtual with WIn 2012 R2 installed.
SQL server has been installed.

Now issue is all server memory is going above 90% and servers are very slow.
Hi Experts,

I would like to transfer over a DB to someone.
1-What is the command to execute to make a bak of that file to a given destination?
2- Will that person be able to restore that db without having my login/pwd?
3- In order to create that backup I had to run the following (as all views were converted by the import utility as tables with the view's names..)
select 'sp_rename ''['+name+']'', '''+replace(name,'view_','')+''';'+ char(10)+CHAR(13)+ 'go' + char(13) from sys.tables where type='U';

Open in new window

However the I had to go to every single line and click enter before the GO, how can I avoid that?

Thanks in advance

I have gridview. chexbox is inside gridview. its giving an error when there is no data . Checkbox ix a bit field. How to resolve it.

  <asp:TemplateField HeaderText="Status"  HeaderStyle-HorizontalAlign="Left"   >
                  <asp:CheckBox ID="lbIsActive" Enabled="false" runat="server"  Text="" Checked='<%# Eval("IsActive") == DBNull.Value ? false :  Eval("IsActive") %>' /> Is Active?
                 <asp:CheckBox ID="rdIsActive" runat="server" Text="" Checked='<%# Eval("IsActive") == DBNull.Value ? false :  Eval("IsActive") %>'/> Is Active?
                 <asp:CheckBox ID="inIsActive"  runat="server"  /> Is Active?

   protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)

   protected void LoadAllApplications()
            AppAccessDataLayer obj = new AppAccessDataLayer();
            DataSet ds = obj.GetAllApplications();

            int count = ds.Tables[0].Rows.Count;
            if (ds.Tables[0].Rows.Count > 0)
                gridView.DataSource = ds;

Open in new window

It's time to update sql server.  But I can't access the databases on this instance of sql server 6.5.  See image for error.  Notice there is a green light, but when I try to expand, I get the error.  Interestingly, the legacy program that is associated with the databases on this instance runs just fine.  Any ideas how I can get to the data via enterprise manager?
error message
I have a program that uses sql server database.  When I try to log in the first time it gives me a Login timeout expired window.   I click ok and then try to login again and it works.  Any ideas how to fix this??
I can not send mail through the SMTP connection manager (send mail task).

attched file

Previously I was able to make use of an sysadmin account on our client's server to create jobs and execute packages. The client has now changed the rights of this account so it's not a sysadmin anymore and now the jobs are failing. They don't want to give me another sysadmin account. I now need to know how do I go forward in giving this new account permissions to run Sql Server Agent jobs and to execute packages. The account they have created for me is not a windows login but only a sql login.

I Created a WebGrid using MVC but when i try to run I am getting this Error Message "SqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.", I Checked SQL Server Logs but it is not even Connecting the Database, It is timing out after 1 minute, I Included these Timeouts but it is not working, Please help.
binding name="basicHttpBinding"  				 
closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" 

Open in new window

We have a server 2008 R2 server with SQL server 2008 R2, running 16 GB of memory, 64 bit OS, Xeon X340 @ 2.4Ghz.

All resources are funnelled towards the SQL application, we seem to have intermittent slow down and performance issues where the Disk queue jumps up to 2.95, IO is 10 MB/Sec

System PID 0 is using the most total Bytes per second of: 8,720,200

Heaviest disk IO is the SQL application itself.

This only seems to happen sporadically two or three times a day, and I haven't been able to correlate it to any specific task or backup job running during that period of time.

This SQL server services multiple sites with users directly accessing the database (no terminal server or replication to local SQL). And all users are affected by the performance issues.

The disk speed is 7200 RPM and the server hosting them is from 2010.

Any ideas?
How Blockchain Is Impacting Every Industry
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.


I have a dataset of units being bought and/or sold. The deal ID is determined by column D and you may buy and sell units under the same deal. Column E is just some descriptive for the deal.  

Original dataset


d1 e1 B  200  null
d1 e1 S  null 100
d2 e2 B  500  null

Evaluate if B_VAL > S_VAL given same D then return one row only but with BS as B and keep both the B_val and S_val on the same row.

d1 e1  B 200 100
d2 e2  B 500 null
How can i add a field in a table  at particular position.

Is it possible to avoid dropping the table and recreating it.

Hi ,

Please provide detailed procedure for In-Place Up-gradation from MS SQL Server 2012 to MS SQL Server 2014 include MSBI Components like SSIS Packages, Cubes/OLAP Databases and SSRS Reports.

Please consider this high priority.

Hello Experts

I have developed a package that works very well in development. I do 2 things
1. I publish it to the SSIS server
2. I call you through a job

In the execution of the job falls for a subject of permissions
This is the error
Error: 2017-08-12 13:53:28.56
   Code: 0xC0016016
   Source: DWH 
   Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Clave no v lida para utilizar en el estado especificado.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
End Error
I need the strings below to build properly...


This is not building correctly

IF @strTourStatus = ''
        SELECT @strTourStatus = COALESCE(@strTourStatus + ',', '') + '''' + TourStatus + ''''
        FROM   (   SELECT DISTINCT TourStatus
                   FROM   everyware_t_tour WITH ( NOLOCK )
               ) pc;
Hey everyone, I'm looking for suggestions and/or different points of view.

My company is collaborating with an external vendor (different domain than mine), and in that effort we need to keep a updated copy of the vendor's database internally.  Currently, we are simply having the vendor take a full backup every night of their database, we transfer it electronically and then we are restoring that database internally.  We'd like to have our internal database refreshed more frequently than once a day however.  Our internal users need to have full control over the internal copy of this database.

We're using Microsoft SQL 2014 on all instances involved.

What is the best way of going about this with the following (perceived) limitations:
          1. Log Shipping - The database cannot be in "read-only" mode during business hours
          2. Backup and restore - This means we can only have a daily restore, as the database needs to be live all day
          3. Availability Groups - The instances involved are in different domains
          4. Replication - This functionality seems to have many deprecated features

In advance, thanks for any help,
convert month name to month number in sql server 2012
Eg : Aug means current yearand month (201708)

I am studying the pros and cons of multi site architecture of MS SQL, oracle, MySQL and sybase. I know about MySQL and I am focusing on MS SQL now.

other than AOG, anything else can be good for MS SQL on 2 x data center MS SQL configuration/topology ?
I have a very large stored procedure. When I run it, I would like to find out which lines were executed. I could insert about one hundred print statements every few lines, however that would take a long time and not look good.

Is there anyway to see which lines in the stored procedure were executed without using print satements?
Free Tool: SSL Checker
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I have lost access to the Distributor and Subscriber servers, and need to delete the publication.
I managed to delete the (pull) subscription database, locally only, so the subscription still shows as orphaned, on the publisher server.

I am trying to simply delete all replication related components.

I am trying to remove the publication, but I get an error that it cannot be removed due to a connected subscription.

I then try to remove the subscription, usign the script below - but I get a message that the subscription does not exist?

Can anyone help with why?

(Remove Subscription Command)

--Select your publication database



DECLARE @publication AS sysname;

DECLARE @subscriber AS sysname;

--enter your publication name

SET @publication = N'NxPub';

--enter subscriber name

SET @subscriber = N'NxSub';


EXEC sp_dropsubscription

@publication = @publication,

@article = N'all',

@subscriber = @subscriber


This is a follow up to this question.

So the accepted solution is doing what I want it to do, but I have 1000's of duplicated values bases on the directories and files that are being queried.   As Qlemo suggested I would be better off creating second table or not more to house the distinct values and just reference them rather than build a monster flat table.

So lets use this as an example:

\\Server1\Folder-A\subfolder-x\File0001 -- \\Server1\Folder-A\subfolder-x\File1000  There is no need to keep writing \\Server1\Folder-A\subfolder-x  

Can someone (Qlemo or anyone else that helped) point me in the right direction on how to accomplish this so my DB can be smaller in size?
insert into [dbo].[AspNetUserRoles]
select '711a1c69-32d9-46ce-bfeb-7b23524b8753',Id,'abcabcabcbacbab',getdate(),getdate()+subscription_days,subscription_credit
from  [dbo].[AspNetRoles]
where name = 'Ultra'
We are in the process of building a new production Windows Server 2016 server to run SQL Server 2016 Standard Edition.
Is there a recommendation from Microsoft to use  ReFS for data and log files in SQL Server 2016 Standard Edition.

Can someone advise
Hi Team,

Requirement :   I want to roll up the measure values from Week-->to Month-->to Quarter-->to Year.

Issue : measure values are not rolling up.

Methodology Used (Method 1 in code attached) :

Used roll up function in sql server and pushing the aggregated values in to temp table(#) . Then pushing the values from temp table  in to respective physical tables based on the column values (Fiscal_Year/Fiscal_Month/Fiscal_Quarter/Fiscal_Week).

Reason to use this method :  
Underlying table( mba_related_sales_by_day ) has billions of records . Henceforth can't afford to do repeated aggregations from Year table  to Quarter table  to Month table  to week table  as this consume lot of time . In order to reduce the timelines of the ETL processing ,used this method.

Please find the attached code.

Please Note :
Method 1 : No performance issue , but not giving right results . Rollup is not working.
Method 2 : This method is not working for large data sets , has performance issues . But working for smaller data sets (1 calendar day).

Please correct my code(method 1) and help me  with the solution. Will appreciate your quick reply in this regard.


I have a table in a clients production database that I need to copy records from (daily) into a table on their report server.

The appropriate columns in the table in the production system look something like:

ID - counter
GroupID - nvarchar
docDate - date
Field4     -  numeric
Field5     -  numeric

The destination table has all of these columns, but also has a column (Time_Zero) which is an integer, and needs to increase by one for each day within each GroupID (this allows the client to graph data by either date, or compare Groups over time based on different start dates - which each have a Time_Zero value of 1).  Because the values in Field4 and Field5 can be changed for up to two weeks after the record is initially entered, I intend to perform a MERGE operation by selecting all of the above fields from the source table, for the last two weeks, and then updating or inserting records into the reporting table based on joins which use the GroupID and docDate fields.

The piece I cannot figure out is how to include values for the Time_Zero field (from the destination table) into the portion of the query that generates the Source values for the Merge operation.

For simplicity, lets just assume that these tables are tblProduction and tblReporting on the same server and in the same database.

Microsoft SQL Server





Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.