Syntax for XML query in SQL

by alski 10. September 2009 13:39
Use the following SELECT Doc.value('data((/OrganisationAccountOpeningForm/KYCCustomer/EntryDate)[1])','datetime') or syntactically SELECT <XML Column Name>.value('data((/<XPATH>)[<1-based index into possible values returned>])','... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Code | SQL | Work

SQL: Grouping DateTimes

by alski 6. August 2009 11:11
Lets say we have some data in a SQL table that represents a series of events with the time that the event occured. The problem is your can't group this data because each Date is exact. You need to round it. Try this. SELECT cast((cast(cast (getdate() as float)*288.0 as int)+0.00001) /288.0... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

SQL

One for James - where or join on

by alski 29. December 2008 17:26
Must be about a month ago now, myself and James were trying to work out the difference between select * from a inner join b on a.x = b.y and a.z = az and select * from a inner join b on a.x = b.y where a.z = az Thing is we couldn't find a difference and thought it may even assist in the sql ... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Code | SQL

Recovering a DB

by alski 10. August 2008 20:16
While I already mentioned a link to recovering a DataBase without an easy backup, here are the previous commands I used to do it. SELECT state_desc FROM sys.databases WHERE name = 'CommunityServerAlSki';   ALTER DATABASE CommunityServerAlSki SET EMERGENCY; AL... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

SQL

Last post before recovery

by alski 9. August 2008 21:33
So my site has been down for far too long, but that's because I have. Moved to an external host due to the failure of my server box. Moved to BlogEngine.Net from CommunityServer Recovered my machine to get the original posts back out I replaced one half of mirrored... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Blog | Hardware | SQL

Enable SQL CLR in TSQL

by alski 10. June 2008 23:01
If you need to enable SQL CLR and can't get at the Surface area configuration tool. EXEC sp_configure 'clr enabled', 1;RECONFIGURE WITH OVERRIDE;GO Simple really. Of course you will need permissions or else you get Msg 15247, Level 16, State 1, Procedure sp_configure, Li... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

SQL

Mock the DAL or Mock the Db

by alski 4. February 2008 21:24
Now they say that the only thing your can be sure of as an aspiring good developer is that the "good" code you write today will become the "bad" code of tomorrow. So with that in mind, its time for a turnaround of opinion that so big I should be applying for a government positi... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Code | SQL

CLR integration - SQL

by alski 15. January 2007 23:06
Just written my first C# SQL function, here it is in all its glory.   [Microsoft.SqlServer.Server.SqlFunction] public static DateTime GetSunday(DateTime original) {     DateTime result = new DateTime(original.Year, original.Month,     &n... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Code | SQL

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

RecentComments

Comment RSS