You are currently browsing all posts tagged with SQL Server

PowerBuilder ‘Gotcha’ – Column lists do not match

Posted on September 11, 2012 at 8:08 pm in

This is more of a database driver error but I encountered it within a datawindow I was working on so PB gets credit. I was working on a generic data drill down control which has a filtering process to eliminate data based on a date argument. Since I also wanted this date value for other…

PowerBuilder ‘Gotcha’ – Column lists do not match - the full story »

Comment on PowerBuilder ‘Gotcha’ – Column lists do not match »

Sending iCalendar events via a .Net Assembly and SQLServer stored procedure

Posted on July 31, 2012 at 5:01 pm in

As I’ve mentioned in earlier posts, the iCalendar format is a standard way to send event information to a variety of email/scheduling systems (Outlook, Google, etc.). Here is a way to set it up so that you can simply call a stored procedure to send the event. This assumes you have SQL Server set up…

Sending iCalendar events via a .Net Assembly and SQLServer stored procedure - the full story »

11 Comments on Sending iCalendar events via a .Net Assembly and SQLServer stored procedure »

PowerBuilder – SQL Native Client and DisableBind

Posted on March 19, 2012 at 5:51 pm in

Okay so you are upgrading your application, perhaps using the latest version of PowerBuilder (12.5) and SQL Server (2008 R2), and decide to use the SQL Native Client (SNC) to take advantage of new features in the database. Now like many organizations which use Microsoft SQL Server, you may have gone to OLE DB in…

PowerBuilder – SQL Native Client and DisableBind - the full story »

1 Comment on PowerBuilder – SQL Native Client and DisableBind »

SQL Server Identity Columns – Inserting and Resetting

Posted on September 27, 2011 at 8:20 pm in

So I wanted to test a scenario against a database table which had no rows, even though there were several currently in the table. Easy you say, just copy the data into a ‘backup’ table, delete the rows, run your tests, then copy the data back. Well not so fast when you have an IDENTITY…

SQL Server Identity Columns – Inserting and Resetting - the full story »

Comment on SQL Server Identity Columns – Inserting and Resetting »

Calculate the Last Day of the Month

Posted on September 16, 2011 at 8:20 pm in

Here is how to calculate the last day of the current month. Powerbuilder date ld_eom ld_eom = RelativeDate(Date(String(Month(Today()) + 1) + “/1/” + String(Year(Today()))), -1) SQL Server SELECT DATEADD(DAY, -1, DATEADD(MONTH, DATEDIFF(MONTH, 0, Getdate()) +1, 0)) I quess SQL Denali has a new function (EOMONTH) to do this too. SELECT EOMONTH(GETDATE())

Calculate the Last Day of the Month - the full story »

Comment on Calculate the Last Day of the Month »

Joining to a Table Function in SQL Server

Posted on September 9, 2011 at 8:20 pm in

Following up on my previous post, SQL Server (since version 2005 while in SQL 90 compatibility mode) provides the ability to join to the table created by a parameterized table function. In earlier versions you were not able to use a table function with a dynamic parameter or even join to it. If you needed…

Joining to a Table Function in SQL Server - the full story »

Comment on Joining to a Table Function in SQL Server »

Splitting up a String or Text in SQL

Posted on September 9, 2011 at 8:15 pm in

Here is a way to split up a block of text and return a result set based on a delimeter. A table function is used to do the ‘heavy lifting’ and, utilizing some newer features of SQL Server (2005 and 2008), you can even join to it providing for even greater flexability. This situation I…

Splitting up a String or Text in SQL - the full story »

1 Comment on Splitting up a String or Text in SQL »

Powerbuilder ‘Gotcha’ – SQLServer OLE DB and Identity columns

Posted on March 2, 2011 at 8:20 pm in

So I get a new machine at work and I’m busy loading all my development tools on it as well as changing settings and all such stuff. SQL Server and Powerbuilder get installed and upgraded, connected to Source Control, and I run the application from within the IDE. Things are fine until I insert a…

Powerbuilder ‘Gotcha’ – SQLServer OLE DB and Identity columns - the full story »

Comment on Powerbuilder ‘Gotcha’ – SQLServer OLE DB and Identity columns »

Sequence Numbers

Posted on February 7, 2011 at 8:20 pm in

Here is a link to a very good article on SQLServerCentral.com showing a technique to re-sequence items via a database stored procedure rather than on the client. It’s pretty straight forward and solves a fairly common issue I’ve addressed several times in Powerbuilder over the years.

Sequence Numbers - the full story »

Comment on Sequence Numbers »

Update Columns in Database

Posted on January 28, 2011 at 8:20 pm in

It’s pretty common to want to update a column (or several columns) in one table with the value(s) from another table. Here is how to do it: UPDATE Table SET Table.col1 = other_table.col1, Table.col2 = other_table.col2 FROM Table INNER JOIN other_table ON Table.id = other_table.id WHERE … The structure of this syntax is always something…

Update Columns in Database - the full story »

Comment on Update Columns in Database »

Top