quarta-feira, 4 de setembro de 2013

SQLServer Tip's - Procedure, rename table, xml, dynamic SQL


1. Introduction

I'm just gathering references to well done post and documentation about SQLServer.

2. References

2.1. Stored Procedure - with parameters

IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'sp_edi_transf_dummy')
DROP PROCEDURE sp_edi_transf_dummy 
GO

CREATE PROCEDURE sp_edi_transf_dummy
  @pIdLoteEdi int 
AS 
    SET NOCOUNT ON;
    INSERT INTO coc_param_proc_lote_edi ( id_lote_edi, param, id )
    VALUES (@pIdLoteEdi, 'proc_transf_dummy', @pIdLoteEdi);
GO


2.2. Rename Table Column


sp_RENAME 'my_table_name.old_column_name', 'new_column_name' , 'COLUMN'




2.3. Oracle equivalents in SQLServer



2.4. String, Date and Time conversion in SQLServer


2.5. String and Int conversion in SQLServer



2.6. Dynamic SQL




2.7. XML








Java Tip's - JOptionPane, JDBC call to SqlServer Stored Procedure

1. Introduction

I'm just gathering references to well done post and documentation about Java.

2. References

2.1. JOptionPane - Java MessageBox

2.2. JDBC call to Sqlserver Stored Procedure with parameters



    2.3. Reading and Writting Excel files using apache POI



      2.4. JDBC Sqlserver Getting value of last AUTOINC sequence column inserted

        pstmt = conn.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);
        int insertCount = pstmt.executeUpdate(); // execute insert statement
        System.out.println("Insert Count:" + insertCount);
        ResultSet resultSet = pstmt.getGeneratedKeys();
        if (resultSet != null && resultSet.next()) {
        logId = resultSet.getLong(1);
        }