Go Premium for a chance to win a PS4. Enter to Win


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

As DBA's point of view
I am working as a MS SQL DBA, I want to know,
What is the Difference between MS SQL Server and PostgreSQL?
Free Tool: Port Scanner
LVL 11
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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 a stored proc that is using ROW_NUMBER to generate a specific sequence. Based on the last # generated, I need to use this # as a seed value in another stored proc to continue the sequence.

Is it possible to insert the last row number generated into a table? Is there a more elegant solution to this?

Thanks in advance!

Please go through the image.

I found this on one of our customer sql server 2008 R2 cluster. This is Active/Passive. In this image i can see 2 nodes are mentioned as Preferred owners? What does it means? is there any impact?  
I restored a SQL database on a new 2016 server (SQL standard 2016).  Database seems to run however something seems wrong.  The database is for a CRM program called "office tools".  I have attached screen shots.

I believe I should see the SQL instance in Sql Server Configuration Manager however it does not appear.

I have a table that holds a ID that is made up of a Value+Date+hourminute , RowNumber , ClosingPrice, MovingAverage7 (7minutes), MovingAverage77 (77 minutes) and Signal ( when 7 is iether over or below 77 )

My table is populated every minute and im looking to try and change my query to be able to change the timescale from 1 minute to 343 minutes. So should basically get 343 minutes average and on that get the 7 minute and 77 minute average.

I have attached my data output from this query

WITH CTE_DailyQuote (MarketDate, ClosingPrice, RowNumber, MA7, MA77)
       ROW_NUMBER() OVER (ORDER BY [ID] ASC) RowNumber,
FROM   [Blockchain].[dbo].[vw_BassLineData]
SELECT MarketDate,
       IIF(RowNumber > 6, MA7, NULL) MA7,
       IIF(RowNumber > 76, MA77, NULL) MA77,
          WHEN RowNumber > 76 AND MA7 > MA77 THEN 'Over'
          WHEN RowNumber > 76 AND MA7 < MA77 THEN 'Below'
          ELSE NULL
       END as Signal
FROM   CTE_DailyQuote
ORDER BY MarketDate desc

Open in new window

I have attached my moving average results and also what the table looks like that my above query runs on in 2 tabs.

I have also attached what the Chart should look like BTC-LTC-MovingAverage-343---7---77.PNG
Thanks in advance :-)
i got this msg when preview the report(cystal report 8.5) after i change the server n database SQL server 2012 express
I have an SSRS report....it was working fine it seemed in that I was handling blanks...but then I reliazed I had nulls in my data...and since then I have not been able to get it to work.

Here is how im handling nulls.  I will show you all the where clauses..im essentially handling them all the same.  

I will also provide the dataset for two of them so you can see how im manipulating the dropdown.

In the where clauses below..it was working with blanks....
In the native linked for example..if the  user selects all...I changed it so is null should be part of all....not sure if thats correct ..but I need is null to show in those params.

In the others I added the coalesce...that also does not seem to be working.  In my report I change the value in the dropdown for a blank to the word 'None'...and that is why you see my use of none here.  I do not pass the choice for null in my dropdowns...but the situation needs to be handled so isnull values would appear just as if they were blanks.

CAST(c.cUdf4 as DateTime) between @DateClientCreatedStart and @DateClientCreatedEnd 
(((@NativeLinked = 'Native' or @NativeLinked= 'Linked') and t2.[Native/Linked] = @NativeLinked) or ((@NativeLinked = 'All') and t2.[Native/Linked] is null or  @NativeLinked = 'Native' or @NativeLinked= 'Linked'))
(((@ActiveClient = 0 or @ActiveClient= 1) and c.lActive = @ActiveClient) or ((@ActiveClient = 2) and @ActiveClient = 0 or @ActiveClient= 1 or c.lActive is null))

Open in new window

hi experts
I have a server that is already making the backup and I want to save it somewhere else (Shared Path), it is understood that I should create a folder and give the permissions to (NT SERVICE \ MSSQLSERVER), but it does not take it, because that I must be on my own PC or server, in these cases as it is done, since it is understood that the backup of the database must not be on the same server.
I have a SQL 2012 Server with a 16GB database and the log file is almost 37GB.  I thought my nightly backups would truncate the old logs and maintain a reasonable sized log.  How can I reduce the size of it and manage it better?
Dear EE,

We have two servers.

1) Citrix XenApp 6.5.
2) Database Server MS SQL 2008 R2.

We need to publish SSMS (SQL SERVER MANAGEMENT STUDIO) on our Citrix Xen App 6.5. Please tell me is it POSSIBLE or NOT.

If possible please confirm HOW we can do that thanks.

Get free NFR key for Veeam Availability Suite 9.5
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

I am looking for a simple solution to replicate production 2008 SQL DB's  into Lab 2008 SQL  server continuously..

Can someone recommend a simple solution to do this please?


Curious if it's possible for certain network devices say Juniper, brocade or Palo Alto firewall OIDs that display Anyconnect VPN active sessions, high availability status, SIP Trunks or Chassis Cluster Failover? I'm trying to monitor these in SCOM (Operations Manager) and I need to import these for monitoring.

Thanks in advance

I have a very basic SSIS package which copies records from a SQL database table to an Oracle database table.  Although it executes correctly without error, there is a persistent 'WARNING' icon on the lookup component.  The warning is:

[Lookup [2]] Warning: Cannot retrieve the column code page info from the OLE DB provider.  If the component supports the "DefaultCodePage" property, the code page from that property will be used.  Change the value of the property if the current string code page values are incorrect.  If the component does not support the property, the code page from the component's locale ID will be used.

I have resolved this same warning on the OLE DB source and destination components by setting the property "AlwaysUseDefaultCodePage" to TRUE but the LOOKUP component does not seem to have this property.

My question is:
Is there something I can do to resolve this warning on the LOOKUP component in the data flow or is it ok to ignore it as the package executes successfully?

Thank you for your help! (I am new to SSIS...)  I am developing the package using Visual Studio 2010 Shell

This is a screenshot of the data flow so you can see the warning is on the lookup component:
SSIS Lookup Component Warning screenshot
How to query last 2 months CPU history using T-SQL in SQL Server 2008 R2?

One of our users got a new machine.  Obviously, this "event" has caused him to lose the ODBC connections used within Excel's Workbook Connections.

I tried to recreate the ODBC connections through Administrative Tools in Control Panel, based on the settings in the Excel "Workbook Connections" Properties.

Unfortunately, upon refreshing the workbook, I received the error message saying "Data source name not found and no default driver specified."

Excel, then, brought up the "Select Machine Source" window.

My ODBC connections did not appear in that window.  So, I clicked its "New" button and got a message saying that the user is logged in with "non-Administrative" privileges.

I confirmed with IT, over a remote session, that the user's login is indeed an Administrator on this Windows 10 machine.

IT and I are both befuddled.

Any ideas?

Thank you!  Much appreciated!

I have created a stored proc to determine from a form textbox value if this value is in a table.  

I run an IF EXISTS
               ELSE IF EXISTS
               ELSE IF EXISTS

For some reason instead of entering information once in table, it is entering it 3 times????  Do you know what would make it do that?
I have a table that I need to count the transactions in each 5 minute block

Columns are CampaignID, IndividualID and DateSent

I need  output like this...

CampaignID   Started                          +5     +10    +15    etc....   Total
123                   2017-10-01 5PM         20      21        19    .....       123  
123                   2017-10-21 3PM         13      2          33    .....       225

I have SQL server 2008 r2 setup on a Windows 10 pc. Everything works fine. When I log in to Microsoft SQL Server Management Studio the password is auto saved and allows me to log in. How can I get this password?

anyone know the work around for the below?

insert into #PutInvbelowSafety
execute Rpt_InventoryBelowSafetyStockSp
NFR key for Veeam Agent for Linux
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Hello experts,

I have the following query which allows me to identify the various lines with under_score:

SELECT Cardinality,
SPoTInternalID  FROM mstt_schema.SPOT_MSTT_MATCH
WHERE CHARINDEX('_' ,SPOTinternalID ) > 0


Cardinality      MSTTID      SPOTID      SPoTInternalID
1-1      1BN6Q5F_20171112      1BN6Q5F_20171112      439378_20171112
1-1      1C236S2_20171112      1C236S2_20171112      574109_20171112
1-1      1CKL7AK_20171109      1CKL7AK_20171109      901162_20171109
1-1      1CKL8TV_20171109      1CKL8TV_20171109      901238_20171109

I am looking for an update query in order to remove all the characters which are after _

The expected result is the following:

Cardinality      MSTTID      SPOTID      SPoTInternalID
1-1      1BN6Q5F      1BN6Q5F      439378
1-1      1C236S2      1C236S2      574109
1-1      1CKL7AK      1CKL7AK      901162
1-1      1CKL8TV      1CKL8TV      901238

Thank you very much for your help.
Hi Experts,

I have this bit of code:
Declare @NotUsedDays as int 
Set @NotUsedDays = 120

SELECT Distinct 
Convert(Date, [LastUsedDate], 120) as LastUseDate,

  FROM [LSV].[BISL_SSRSLog].catalog C

  JOIN (

                SELECT ReportID,LastUsedDate= MAX(timestart), StatusKey 

                     FROM [LSV].[BISL_SSRSLog].[ExecutionLog]

                       WHERE RegionName = 'Region that is in charge of SharePoint'

                       and ReportLocation = 'Location'

                       and Environment = 'Production'

                       and SPVersion = 2013

                       and (DateKey like '2016%' Or Datekey like '%2017%')
					    and [USERNAME] Not In ('bah1', 'bah2')

                 GROUP BY ReportID, StatusKey

          ) E

       --ON C.ItemID = E.ReportID

       ON C.ReportID = E.ReportID

 WHERE DATEDIFF(DD,LastUsedDate,GETDATE()) >= @NotUsedDays And StatusKey <> 34 -- 34 = Non existing reports??? 

 ORDER BY NotUsedsince desc

Open in new window

As you can see I am guessing that 34 means the reports are not available out on the share.  I am also guessing that column "Statuskey" is the correct column?

As a result I get reports that are no longer available (they have been deleted)

I want only reports that are available to come up in the query.

Thank You,

Is there a way to create a SQL linked server from SQL Server 2016 to SQL Server 2005?

Many thanks
I have attached the execution plan.Please have a look on that.
SELECT NewID(), Transactions.Transactions, Matters.Matters, Matters.MatterID, Matters.ShortDesc,
 Matters.AreaOfLaw, Matters.MatterType, Matters.ClientSort, Professionals.Professionals, Professionals.Initials, 
 Professionals.Office, Professionals.ProfClass, Professionals.ProfDept, Professionals.ProfType, 
 Professionals.ProfName, TaskCodes.TaskCodes, TaskCodes.CodeId, Transactions.MattersProjects, 
 MattersProjects.ProjectDesc, MattersProjects.ProjectAmount, ActivityCodes.ActivityCodeId ,
  ActivityCodes.ActivityCodeDesc, '4a0d2393-2e80-4a88-ac38-688b6f956852',
	 '77bdcf50-bb5e-479b-af19-8058295c8252', GetDate()   FROM FeeAnalysis INNER JOIN Transactions 
	 ON Transactions.Transactions = FeeAnalysis.Transactions LEFT OUTER JOIN MattersProjects 
	 ON Transactions.MattersProjects = MattersProjects.MattersProjects LEFT OUTER JOIN ActivityCodes
	  ON Transactions.ActivityCodes = ActivityCodes.ActivityCodes LEFT OUTER JOIN Professionals
	  ON Transactions.Professionals = Professionals.Professionals LEFT OUTER JOIN TaskCodes 
	  ON Transactions.TaskCodes = TaskCodes.TaskCodes LEFT OUTER JOIN StmnLedger 
	  ON Transactions.StmnLedger = StmnLedger.StmnLedger INNER JOIN Matters 
	  ON Transactions.Matters = Matters.Matters INNER JOIN SecurityILSKey 
	  ON SecurityILSKey.ILSKey = Matters.ILSKey 
	  AND SecurityILSKey.Professionals = '4a0d2393-2e80-4a88-ac38-688b6f956852' 
	  LEFT OUTER JOIN MatterTypes ON Matters.MatterType = MatterTypes.MatterTypesDesc
	   INNER JOIN Components

Open in new window

I have three tables:    tCheckout                  tUsers                                                                                             tTypes data
                                       UID                             UID                                                                                                 TypeID   TypeName
                                       UName                      UName                                                                                                 1       Regular
                                       TypeID                       Regular  (1 or 0)                                                                                   2       Small
                                       Checkout_Date         Large     (1 or 0)                                                                                   3       Large
                                       Checkin_Date            Small   (1 or 0)

I have to insert a, Userid, TypeID, and checkout date into the Checkout table based on different type fields in the Users table to determine if user can update records.  I would like to write a  query to include a CASE statement to insert TypeID into the Checkout table with the use of variables.  I will be inserting this query into a stored procedure.  Can you help me with this please.

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.