Abundant Code

  • C#
  • C++
  • Elastic Search
  • Entity Framework
  • F#
  • JavaScript
  • ASP.NET
  • C
  • Java
  • SQL Server
  • Assembly Lang
Home ยป database

Checking the version of a SQL Server using T-SQL

September 16, 2016 by AbundantCode Leave a Comment

There are couple of ways in which you can retreive the version of the SQL Server using T-SQL.

Checking the version of a SQL Server using T-SQL

1. using @@VERSION

SELECT @@VERSION
image

2. Using SERVERPROPERTY function as shown

SELECT SERVERPROPERTY('productversion') 
…

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

How to get the first character of a string in SQL Server ?

September 16, 2016 by AbundantCode Leave a Comment

Assume a scenario where you have a column in your table in SQL Server database where you want to retreive the first character of the column value.

How to get the first character of a string in SQL Server ?

…

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

How to change the ‘Edit Top 200 Rows’ in SQL Management Studio ?

September 15, 2016 by AbundantCode Leave a Comment

When working with the SQL Server Management Studio and trying to edit the table records , you would have noticed the context menu option “Edit Top 200 Rows”.

image

How do you change this to display all the records for editing

…

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

How to Check if a login exists in SQL Server ?

September 14, 2016 by AbundantCode Leave a Comment

If you need to check if a login exists in SQL Server , you can use query the master.dbo.syslogins for it.

How to Check if a login exists in SQL Server ?

Here’s a sample query demonstrating how you can …

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

What is the equivalent of MySQL’s Now() function in SQL Server ?

September 14, 2016 by AbundantCode Leave a Comment

MySQL has the function Now() which is a Datetime type field which shows the current date as well as the time.

What is the equivalent of MySQL’s Now() function in SQL Server ?

In SQL Server , you can use …

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

How to get the first day of the month in SQL Server ?

September 7, 2016 by AbundantCode Leave a Comment

If you want to get the first day of the month of a input datetime variable from a SQL Query , here’s how you do it.

SELECT DATEADD(month, DATEDIFF(month, 0, GetDate()), 0) AS StartMonthDate
image
…

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

Get the date in YYYY-MM-DD format in SQL Server.

September 7, 2016 by AbundantCode Leave a Comment

You can retreive the date in the YYYY-MM-DD format in SQL Server using the CONVERT method as shown in this code snippet.

How to get the date in YYYY-MM-DD format in SQL Server ?

SELECT CONVERT(char(10), GetDate(),126) as abundantcodedate
How to get the date in YYYY-MM-DD format in SQL Server ?
…

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

SQL Server – Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created.

September 7, 2016 by AbundantCode Leave a Comment

There are times when you get an error stating

“Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created …

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

How do you check if an index exists in a table?

September 6, 2016 by AbundantCode Leave a Comment

You can find out if the index exists for a table by querying the sys.indexes table as shown in this blog post’s code sample.

How do you check if an index exists in a table?

Use AdventureWorks2014
GO
SELECT * 
…

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

How to select N random rows using a T-SQL Query ?

September 4, 2016 by AbundantCode Leave a Comment

You can use the TOP keyword and specify the number to retreive the TOP N records that the query returns. Additionally , order the records by newid() function using the ORDER BY clause to make the records random.

How to

…

Filed Under: SQL Server Tagged With: database, How to, SQL Server, tips, tricks

  • 1
  • 2
  • 3
  • 4
  • Next Page »
RSS
Facebook
fb-share-icon
Twitter
Visit Us
Follow Me
Tweet

Recent Posts

  • InvalidModuleDescriptorException when running java program in Eclipse IDE
  • Python Program to Check Armstrong Number
  • Collapsible links for subcategories in Docusaurus Sidebar
  • Python Program to Print Fibonacci Series
  • Python Program to Generate Multiplication Table

Categories

Tags

.NET App Array ASP.NET ASP.NET MVC Assembly Language C# C# programs c lab programs Collection convert C program csharp database Example F# guide How to How to in Java integer Java Javascript Lab programs Lambda LINQ List Python lab programs Python programs SIC/XE SQL Server string tips tricks tutorial tutorials UWP visual studio 2015 Windows Windows 8 Windows 10 Windows Phone Windows Phone 8 Windows Phone 8.1 wp8 XAML

Blog Stats

  • 8,747,449 hits

Archives

Top Posts & Pages

  • How to Convert a Stream to Byte Array in C# 4.0 ?
  • How to Allow only numeric input in a Textbox in WPF ?
  • How to Quickly Delete All Rows in a Table in Entity Framework?
  • C Program to display half-pyramid using alphabets
  • How to open display settings from command line in Windows 10 ?
  • How to Calculate MD5 checksum for a file in C# ?
  • How to Extract number from a string using C# ?
  • How to clean up unused PowerPoint master slides in PowerPoint?
  • System Software - SIC/XE Program to divide BETA by GAMMA and set quotient and remainder
  • How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

Categories

  • Android
  • Angular 2
  • ASP.NET
  • Assembly Language
  • C
  • C#
  • C++
  • Elastic Search
  • Entity Framework
  • Excel
  • F#
  • HTML
  • Interview Questions
  • Java
  • JavaScript
  • jQuery
  • Microsoft Office
  • MySQL
  • NETWORK
  • News
  • PHP
  • popular
  • PowerShell
  • Python
  • Ruby
  • SharePoint
  • SQL Server
  • SQL Server
  • Unix
  • VB.NET
  • Visual Studio
  • WebAPI
  • Windows
  • Windows Azure
  • Windows Forms
  • XAML

Top Posts & Pages

  • How to Convert a Stream to Byte Array in C# 4.0 ?
  • How to Allow only numeric input in a Textbox in WPF ?
  • How to Quickly Delete All Rows in a Table in Entity Framework?
  • C Program to display half-pyramid using alphabets
  • How to open display settings from command line in Windows 10 ?
  • How to Calculate MD5 checksum for a file in C# ?
  • How to Extract number from a string using C# ?
  • How to clean up unused PowerPoint master slides in PowerPoint?
  • System Software - SIC/XE Program to divide BETA by GAMMA and set quotient and remainder
  • How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

Recent Posts

  • InvalidModuleDescriptorException when running java program in Eclipse IDE
  • Python Program to Check Armstrong Number
  • Collapsible links for subcategories in Docusaurus Sidebar
  • Python Program to Print Fibonacci Series
  • Python Program to Generate Multiplication Table
  • Python Program to Find the Factorial of a Number
  • Python Program to Print Prime Numbers in a Given Interval
  • Python Program to Check Prime Number
  • Python Program to Find the Largest Value Among Three Numbers
  • Python Program to Check If a Given Year is Leap Year

Tags

.NET App Array ASP.NET ASP.NET MVC Assembly Language C# C# programs c lab programs Collection convert C program csharp database Example F# guide How to How to in Java integer Java Javascript Lab programs Lambda LINQ List Python lab programs Python programs SIC/XE SQL Server string tips tricks tutorial tutorials UWP visual studio 2015 Windows Windows 8 Windows 10 Windows Phone Windows Phone 8 Windows Phone 8.1 wp8 XAML