博文

目前显示的是 九月, 2015的博文

JdbcRowSet & SQL Server(Sqljdbc4.jar)

Create a JdbcRowSet object in various ways: 1. By using the reference implementation constructor that takes a ResultSet object 2. By using the reference implementation constructor that takes a Connection object 3. By using the reference implementation default constructor 4. By using an instance of RowSetFactory , which is created from the class RowSetProvider Testing Environment : JDBC driver: Sqljdbc4.jar Java SE Version:1.7.0_51 Result: 1.Passing ResultSet Objects // It works. 2.Passing Connection Objects // It does not work 3.Using the Default Constructor // It does not work 4.Using the RowSetFactory Interface // It does not work import com.sun.rowset.JdbcRowSetImpl; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import javax.sql.rowset. JdbcRowSet ; import javax.sql.rowset.RowSetFactory; import javax.sql.rowset.RowSetProvider;     public static void main(String[] args)...

How to Split a string by delimited char in SQL Server

It is from http://www.sqlservercentral.com/blogs/querying-microsoft-sql-server /2013/09/19/how-to-split-a-string-by-delimited-char-in-sql-server/ A Stored Procedures for testing this function. -- ============================================= SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF EXISTS (SELECT * FROM SYS.objects WHERE name = 'testfnSplitString' AND [TYPE] = 'P') DROP PROCEDURE dbo.testfnSplitString  GO CREATE PROCEDURE dbo.testfnSplitString (@IDs NVARCHAR(MAX)) AS SET NoCount ON SET Ansi_Warnings OFF  DECLARE @output TABLE(IDt NVARCHAR(MAX))  DECLARE @start INT, @end INT,@delimiter VARCHAR(2)=',' SELECT @start = 1, @end = CHARINDEX(@delimiter, @IDs) WHILE @start < LEN(@IDs) + 1 BEGIN IF @end = 0 SET @end = LEN(@IDs) + 1 INSERT INTO @output (IDt) VALUES(SUBSTRING(@IDs, @start, @end - @start)) SET @start = @end + 1 SET @end = CHARINDEX(@delimiter, @IDs, @...