数据库编程
geovindu
为了生活,到处流浪,人间万象这本书是词汇语句难以修辞的,图像影音等介质难以描绘印象的,而一切在表象的存在中去体味....接收各人的角度看法,就因为各人所处环境和意识形态不同,才显得人间的知会智慧.
展开
-
string split function in postgreSQL 17.01 or SQL Server2019 or mySQL 9.0
【代码】postgreSQL 17.01: string split function。原创 2024-11-09 06:56:24 · 361 阅读 · 0 评论 -
Stored procedures in PostgreSQL
select 存储过程,在现了解的情况,还是没有mysql,sqlserver等好写好用。原创 2024-11-08 20:22:24 · 320 阅读 · 0 评论 -
sql: SQLite,MySQL,SQL Server
®Geovin Du Dream Park™ - 博客园 (cnblogs.com)找出各数据库的相同和差异,找出规律规则,用程序生成。原创 2023-06-26 08:25:00 · 724 阅读 · 0 评论 -
sql server: create Trigger using del,insert,update
/*create database geovindu;两数据库之间的一个类似表,进行一个表的操作添加,修改时的同步操作的触发器操作use geovindu;create database DuMapgouse DuMapgo-- Geovin Du,涂聚文--Geovin Du, 塗聚文*/--基础数据设置BasicDataSet--书分类目录kind--BookKindFormIF EXISTS (select * from sysobjects where id.原创 2022-03-06 14:34:18 · 293 阅读 · 0 评论 -
sql: paging in SQL Server
--sql server 2012 及以上 涂聚文 Geovin Du geovindu 注SELECT * FROM BookKindListORDER BY (SELECT NULL)OFFSET 0 ROWS FETCH NEXT 3 ROWS ONLYgo -- geovindu Geovin Du 涂聚文Declare @PageNo INTDeclare @PageSize INTSet @PageNo=1Set @PageSize=4Select * From (S.原创 2021-12-28 19:55:24 · 396 阅读 · 0 评论 -
Mysql问题:Connector/Net no longer supports server versions prior to 5.0
我用Connector/Net 6.9读取MySql 4.1 时,会报以下错:1.Connector/Net no longer supports server versions prior to 5.02.Unable to connect to any of the specified MySQL hosts.后来我下载 http://dev.mysql.com/downloads原创 2015-03-23 12:01:57 · 1321 阅读 · 0 评论 -
MySql:局域网和权限用户管理
MySql 5.6(XP)/5.7(win7) 添加用户和设置局域访问权限操作.请在 http://sourceforge.net/ 下载MySql Control Center(不是安装版本).原创 2015-03-20 12:54:01 · 1099 阅读 · 0 评论 -
csharp:SQLite and Access using C# code read data
SQLite sql script:CREATE TABLE BookKindList( BookKindID INTEGER PRIMARY KEY AUTOINCREMENT, BookKindName varchar(500) not null, BookKindCode varchar(100) null, BookKindParent原创 2015-02-11 15:16:34 · 806 阅读 · 0 评论 -
sql:Mysql create view,function,procedure
use test;create database Liber;use Liber;#顯示數据庫 20150210 Geovin Du 涂聚文SHOW DATABASES;drop table BookKindList;#书目录create table BookKindList( BookKindID INT NOT NULL AUTO_INCREMENT, #自动增加原创 2015-02-10 15:06:27 · 917 阅读 · 0 评论 -
sql: MySQL and Microsoft SQL Server Stored Procedures IN, OUT using csharp code
MySQL存储过程:#插入一条返回值DELIMITER $$DROP PROCEDURE IF EXISTS `geovindu`.`proc_Insert_BookKindOut` $$CREATE PROCEDURE `geovindu`.`proc_Insert_BookKindOut` (IN param1Name NVarChar(1000),IN param1Parent I原创 2015-02-10 11:40:28 · 544 阅读 · 0 评论 -
WHILE (Transact-SQL)
---循环declare @n intdeclare @rowcount int declare @name varchar(50)create table #temp( id int identity(1,1), ColumnNme nvarchar(100))insert into #temp select COLUMN_NAME from 数据库名.INF原创 2015-01-15 11:54:20 · 515 阅读 · 0 评论 -
Recursive sum in parent-child hierarchy T-SQL
---树形(父子关系类)分级类统计(父子统计)--涂聚文 2014-08-14drop table BookKindListcreate table BookKindList( BookKindID INT IDENTITY(1,1) PRIMARY KEY, BookKindName nvarchar(500) not null, BookKindParent原创 2014-08-14 16:23:40 · 532 阅读 · 0 评论 -
sql: Compare Tables
---使用 UNION、INTERSECT 或 EXCEPT 运算符合并的所有查询必须在其目标列表中有相同数目的表达式select * from BookInfoList--存在不同的select BookInfoID,BookInfoBarCode from BookInfoList where BookInfoStatus=1 except select BookInventoryInf原创 2014-06-12 11:26:03 · 683 阅读 · 0 评论 -
sql: postgreSQL sql script
--pg_catalogSELECT * from pg_class c,pg_attribute a,pg_type t where c.relname='BookKindList' and a.attnum>0 and a.attrelid=c.oid and a.atttypid=t.oidSELECT a.attname from pg_class c,pg_attribute a,原创 2015-04-02 12:20:16 · 524 阅读 · 0 评论 -
Getting SQLite metadata with csharp
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Dat原创 2015-03-24 21:24:14 · 1177 阅读 · 0 评论 -
MySQL Stored Procedure Prepared Statement (Dynamic SQL) Parameterized
类似于SQL Server中的:sp_executesqlsql server script:--- 涂聚文 20160906IF EXISTS (SELECT * FROM sysobjects WHERE [name] = 'proc_Select_DuDeptUserCount')DROP PROCEDURE proc_Select_DuDeptUserCountGOCR原创 2016-09-08 17:10:14 · 445 阅读 · 0 评论 -
SQL Server: Get table primary key and Foreign Key using sql query
---某個錶的列名,主键,外键---20150923 涂聚文 SQL Server: Get table primary key and Foreign Key using sql query DECLARE @SchemaName VARCHAR(200),@TableName VARCHAR(200)SET @SchemaName='dbo'SET @TableName='BookIn原创 2015-09-23 10:54:01 · 532 阅读 · 0 评论 -
sql: table,view,function, procedure created MS_Description in sql server
--添加描述 Geovin Du--https://msdn.microsoft.com/en-us/library/ms180047.aspx--https://msdn.microsoft.com/zh-cn/library/ms180047(v=sql.120).aspx--https://msdn.microsoft.com/zh-cn/library/ms179853(v=sql.原创 2015-09-27 22:09:35 · 447 阅读 · 0 评论 -
sql: Oracle 11g create table, function,trigger, sequence
----自动增长ID --序列创建 drop SEQUENCE BookPlaceList_SEQ;CREATE SEQUENCE BookPlaceList_SEQINCREMENT BY 1 -- 每次加几个START WITH 1 -- 从1开始计数NOMAXVALUE -- 不设置最大值NOCYCLE -- 一直累加,不循原创 2015-05-22 09:35:56 · 691 阅读 · 0 评论 -
sql: Oracle 11g create procedure
CREATE OR REPLACE PROCEDURE proc_Insert_BookKindList (temTypeName nvarchar2,temParent int)ASncount number;begin--SELECT COUNT (*) INTO ncount FROM BookKindList fm1 where EXISTS (SELECT BookKi原创 2015-05-26 22:38:41 · 464 阅读 · 0 评论 -
csharp: Oracle Metadata queries
数据类型表:TypeNameProviderDbTypeColumnSizeCreateFormatCreateParametersDataTypeBFILE14294967296BFILE System.Byte[]BLOB24294原创 2015-05-17 00:26:34 · 632 阅读 · 0 评论 -
sql:SQL Server metadata queries
-- 2012--https://technet.microsoft.com/zh-cn/library/ms186778(v=sql.110).aspx--对象目录视图 (Transact-SQL)select * from sys.foreign_keysselect * from sys.foreign_key_columnsselect * from sys.all_colum转载 2015-05-15 17:21:00 · 635 阅读 · 0 评论 -
sql:MySql create FUNCTION,VIEW,PROCEDURE
use geovindu;#函数DELIMITER $$drop function if exists f_GetDepartmentName $$CREATE function f_GetDepartmentName( did int) returns nvarchar(400) begindeclare str nvarchar(100);select Depar原创 2015-04-03 17:56:59 · 822 阅读 · 0 评论 -
sql:查询创建表的结构
--显示所有用户表:--1SELECT SCHEMA_NAME(schema_id) As SchemaName , name As TableName from sys.tables ORDER BY name--2。alternate:SELECT sch.name As SchemaName , tbl.name As TableName from s转载 2014-05-15 23:01:14 · 676 阅读 · 0 评论 -
sql:无法解决 equal to 操作中 "Chinese_PRC_CI_AS" 和 "Chinese_Taiwan_Stroke_CI_AS" 之间的排序规则冲突。
--无法解决 equal to 操作中 "Chinese_PRC_CI_AS" 和 "Chinese_Taiwan_Stroke_CI_AS" 之间的排序规则冲突。 CREATE VIEW View_VipBranchStaffBranchList ASselect VipBranchStaff.*,geovindu_branch.B_Name,VipExamCountry.ExamCoun原创 2014-02-24 14:33:03 · 2498 阅读 · 0 评论 -
sql and csharp: Split Function
T-SQL:declare @int int,@prov int,@city int,@str nvarchar(500)set @str='天河麗特青春:中國廣東省廣州市天河區天河路623號天河娛樂廣場麗特青春百貨一樓,塗聚文'select @int=charindex(':',@str) select @prov=charindex('省',@str) select @city=c原创 2014-02-21 15:08:57 · 686 阅读 · 0 评论 -
SQL 生成公曆和農曆對照數據,公曆查找農曆和農曆查找公曆函數
---数据来源:http://topic.csdn.net/u/20100424/07/29529d9d-bc54-4877-b198-4426b4d85024.html if object_id('SolarData') is not null drop table SolarData go create table SolarData ( yearid int not转载 2012-09-17 16:23:24 · 496 阅读 · 0 评论 -
sql server 2000/2005 script
---2005附加數據庫---ATTACH DATABASE TEMPLATE---涂聚文 2012 元旦exec sp_attach_db 'Asset5','D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Asset5.mdf','D:\Program Files\Microsoft SQL Server\MSSQL.1\原创 2012-01-05 14:49:43 · 431 阅读 · 0 评论 -
SQL SERVER 2000 遍历父子关系数据的表(二叉树)获得所有子节点 所有父节点及节点层数函数
---SQL SERVER 2000 遍历父子关系數據表(二叉树)获得所有子节点 所有父节点及节点层数函数---Geovin Du 涂聚文--建立測試環境Create Table GeovinDu([ID] Int, fatherID Int, [Name原创 2011-08-29 19:48:45 · 2631 阅读 · 0 评论 -
sql server 2000/2005递归
/*递归查询 塗聚文---SQL Server 2005环境下的实现:*/--生成测试数据 create table Dept(ID int,ParentID int,msg varchar(20)) insert into Dept select 1,0原创 2011-08-29 10:39:43 · 636 阅读 · 0 评论 -
sql ntext數據類型字符替換
---ntext數據類型字符替換 ---2011-08-21 塗聚文 深圳大運會期間,政府貼出"溫馨提示",交通管制,世界之窗周邊不充許到陽台觀看,出入憑居住證不是身份證create table tt( sid INT IDENTITY(1,1), cont原创 2011-08-25 10:50:13 · 574 阅读 · 0 评论 -
SQL script 會計記賬 Debit-Credit Bookkeeping
---會計記賬 Debit-Credit BookkeepingCREATE TABLE #geovindu ( Account VARCHAR(20), --賬號 [Date] DATETIME, --原创 2011-08-25 10:53:43 · 1359 阅读 · 0 评论 -
sql 时间计算
---兩個時間之差的合計DECLARE @I INTSET @I = DATEDIFF(ms,GETDATE()-RAND()*24,GETDATE())SELECT convert(varchar(10), @I/86400000) + ' Days ' +原创 2011-08-25 10:52:07 · 1564 阅读 · 1 评论 -
sql uniqueidentifier转换成varchar 数据类型
---塗聚文 Geovin DuDECLARE @myid uniqueidentifierSET @myid = NEWID()SELECT CONVERT(char(255), @myid) AS 'char';GO--塗聚文 Geovin Dudeclare @原创 2011-09-19 20:02:38 · 6844 阅读 · 0 评论 -
sql ntext數據類型字符替換
---ntext數據類型字符替換 ---2011-08-21 塗聚文 深圳大運會期間,政府貼出"溫馨提示",交通管制,世界之窗周邊不充許到陽台觀看,出入憑身份證create table tt( sid INT IDENTITY(1,1), cont原创 2021-03-05 09:11:42 · 83 阅读 · 0 评论 -
SQL 生成公曆和農曆對照數據續--创建萬年曆查找各種周期性節日數據 .
---sql server 2005 測試 塗聚文 捷為工作室,締友計算機信息技術有限公司---查找公曆節日--select (@year-GooddayStaryear) as Gyear,GooddayContent from GoodDaysList where @year>=GooddayStaryear and GooddayStarmoth=@month and GooddayS原创 2012-09-21 12:41:25 · 735 阅读 · 0 评论 -
sql distinct
---沒有去除重復的記錄select distinct ContractLaborEmployeeUidKey,ContractLaborEndDate from ContractLaborList order by ContractLaborEndDate descselect * from ContractLaborList order by ContractLaborEmploy原创 2012-10-31 19:10:59 · 325 阅读 · 0 评论 -
SQL:Example Uses of the SUBSTRING String Function
---Example Uses of the SUBSTRING String Function--http://www.sql-server-helper.com/tips/tip-of-the-day.aspx?tkey=4AB06421-E859-4B5F-A948-0C9640F3108D&tkw=sample-uses-of-the-substring-string-function转载 2014-01-21 12:12:16 · 477 阅读 · 0 评论 -
sql: 生日三个月内有效
DECLARE @birthday datetime,@stat datetime,@end datetime,@statbirthday datetime,@endbirthday datetime,@thirdbirthday datetime,@firthbirthday datetime, @year int,@month int , @day int,@str varchar(20),原创 2013-12-02 15:13:29 · 663 阅读 · 0 评论 -
SQL Server迭代求和
drop table t_geovindu create table t_geovindu ( xid int IDENTITY (1, 1), price money, DebitCredit VARCHAR(2), adate datetime default(getdate()) ) insert into t_geo原创 2013-08-05 17:11:50 · 648 阅读 · 0 评论