/*
T-sql:17 a date-time related Custom function (UDF), Sunday as the last day of the week, not affected by the @ @DateFirst, language version
are collected or refined from the old articles!
Tips:
(@ @Datefirst + datepart (weekday, @Date))% 7 judgment Week is the most insured! Independent of @ @DateFirst and language version
@ @DateFirst may cause datepart (weekday, @Date) different!
No matter what the @ @Da
function | function/*
T-sql:17 a date-time related Custom function (UDF), Sunday as the last day of the week, not affected by the @ @DateFirst, language version
are collected or refined from the old articles!
Tips:
(@ @Datefirst + datepart (weekday, @Date))% 7 judgment Week is the most insured! Independent of @ @DateFirst and language version
@ @DateFirst may cause datepart (weekday, @Date) different!
No ma
Tags: Create PROCEDURE prctestbypage (@tablename varchar (), @selectfilter varchar (100),
@orderbyfilter varchar, @selectpage int, @pageSize int As begin--The stored procedure begins declare @pkname varchar (100)--Gets the primary key name of the table SELECT @pkname =column_name from I Nformation_schema. Key_column_usage WHERE [emailprotected] declare @num int set @num = (@selectpage-1) * @pageSize declare @strsqltwo var CHAR (4000) Set @strsqltwo = ' Select Top '
Handling table:The case is below5. Handling exceptions in OracleDeclareX varchar2 (10 );BeginSelect a1 into x from a where a2 = 'qw'; -- query the value and assign it to the variable.Dbms_output.put_line ('x value '| x );Exception-- Exception Handling data. What should I do if it does not exist?When NO_DATA_FOUND then dbms_output.put_line ('no data ');End;/6. Oracle custom Exception e ExceptionDeclareX varchar2 (10 );E exception; -- Define the except
Customerrepository.java@Query (Nativequery = true, value = "SELECT * Adm_sys_customer ORDER by? #{#pageable}", Countquery = "SELECT count (*) F Rom Adm_sys_customer ") pageCustomerserviceimpl.javaCall Custom SqlpageORDER by? #{#pageable} must be added, otherwise error:Caused by:org.springframework.data.jpa.repository.query.InvalidJpaQueryMethodException:Cannot use native queries with dynamic sorting and/or pagination in ...Reference: https://www.cnblo
The log information of the package does not contain the logs when the package is successfully executed. Sometimes we only care about whether the package is successfully executed or fails.
Although the SQL Server SSIS log provider does not record successful packet execution information by default, you can modify the stored procedure it calls to record a successful message.
1. Right-click the blank space in the control flow of the package and choose j
Tags: strong on data SQL User table function Server storeA user-defined function can be called as a system function in a query or stored procedure, can accept parameters, perform operations, and return the result of the operation as a value. The return value can be a single scalar or result set.1. Scalar functionsScalar functions return a scalar value that determines the type, for scalar functions of multiple statements, the function body defined in t
SET QUOTED_IDENTIFIER ONIdentifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marksSET QUOTED_IDENTIFIER OFFIdentifiers are not quoted and must comply with all Transact-SQL identifier rules.SET NOCOUNT On-Returns the number of rows affectedSET Datefirst 1 SET ANSI_NULLS onAllow comparison operators to return TRUE or FALSE when compared to null values If ColumnA contains a null value, a comparison
Number
Standard parcel Code (LANDCODE)
Section Code (SECTCODE)
1
131001bg001
G001
2
131001bg002
G001
3
131001bg003
G001
4
131001bg004
G002
5
131001bg005
G003
Now you need to convert the data in the table to the results shown in the following table:
Number
Section coding
Included Standard parcel
1
G001
131001bg001,131001bg002,131001bg003
UDFs are similar to stored procedures, where a user-defined function is an ordered set of T-SQL statements that are pre-optimized and compiled, and can be used as a unit to test calls. The main difference between UDFs and stored procedures is the way the results are returned, and in order to support more return values, UDFs are more restrictive than stored procedures.UDF basic syntax: CREATE FUNCTION RETURNS As Begin/* code */ENDThe simplest thing to
UDFs are similar to stored procedures, where a user-defined function is an ordered set of T-SQL statements that are pre-optimized and compiled, and can be used as a unit to test calls. The main difference between UDFs and stored procedures is the way the results are returned, and in order to support more return values, UDFs are more restrictive than stored procedures.UDF basic syntax: CREATE FUNCTION RETURNS As Begin/* code */ENDThe simplest thing to
Tags: Data Warehouse res warehouse IMA Misc SYS cell nbsp HighlightTo configure the Data collector: 1. Create a login and map roles 2. Configuring the Management Data Warehouse 3. Create collection sets, collection items----msdb data store sp_syscollector_create ... 4. Automatically configure the related job Specific steps: After creating the diagram: To configure Data collection: The refresh looks like this: The method created: Use msdb
go
declare @collectionsetid int --return val
F_split: Splitting a string into a data table Create FUNCTION [dbo]. [F_split] (@SplitString nvarchar (max),--source string @Separator nvarchar (10) = "--delimited symbol, default to space) RETURNS @SplitStringsTable table-Output datasheet ([id] int identity (), [value] nvarchar (max)) as BEGIN DECL is @CurrentIndex int; DECLARE @NextIndex int; DECLARE @ReturnText nvarchar (max); SELECT @CurrentIndex = 1; while (@CurrentIndex Result isID value-------- ---------------------------
Label:When the project was recently expanded, the problem was to convert the integral type to a specified length of 16 binaryAt first it was the direct use of cast (varbinary (4)) but finding out this doesn't solve my problem.So I searched the Internet, and then changed, the following is the function:1 Create FunctionInttohexlength (@Num int,@HxLength int)2 returns varchar( -)3 as4 begin5 Declare @Mods int,@res varchar( -),@Length int6 Set @res="'7 while @Num 0 8 begin9 Set @Mods
As always, a short blog post records a problem encountered during the development process. The original intention is to record some of their own idea, but also want to be able to help some coincidence encounter such a problem, the need for the beginning is because, to count the last n weeks of sales data.
Let's take a look at the effect of the execution function, such as SELECT * FROM [dbo]. [Fn_runweek] (-12)
The specific functions are as follows:
-- ===============================
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.