In MS SQL Server, we can achieve the pagination functionality by using OFFSET and FETCH clauses with ORDER BY in a SELECT statement. OFFSET: Represents the number of rows to be skipped from the result set. It should be 0 or greater than 0. FETCH: Represents the number of rows to be displayed in the result. Notes: ORDER BY is mandatory for the use OFFSET […]
Tag: result
How to insert results of a stored procedure into a temporary table
CREATE TABLE #tmpTable ( COL1 int, COL2 int, COL3 nvarchar(max), COL4 nvarchar(max), COL5 bit ) INSERT INTO #tmpTable exec SpGetRecords ‘Params’ NOTE: The columns of #tmpTable must be the same as SpGetRecords. Otherwise, there will be a problem. If there are no parameters in the stored procedure, you don’t need to use ‘Params’.
IndexOf() and LastIndexOf() in C#
The IndexOf() method returns the index number of the first matched character whereas the LastIndexOf() method returns the index number of the last matched character. using System; public class StringExample { public static void Main(string[] args) { string s1 = “Hello C#”; int first = s1.IndexOf(‘l’); int last = s1.LastIndexOf(‘l’); Console.WriteLine(first); Console.WriteLine(last); } } Output: […]
Search text in all tables in SQL Server
Please note that with a little bit changing you can also use this query as a stored procedure.