SQL Server

Linq To Sql not updating on Context.SubmitChanges()

Tonight I ran into a weird problem that I haven’t seen before. I was getting an entity back from a query, changing some values, and calling the DataContext.SubmitChanges() and the database was not being updated. The code ran fine without any exceptions. Weird! I decided to fire up SQL Server Profiler and see what queries were being executed and to my surprise Linq To Sql (L2S) was not executing anything. After 5 minutes of thinking why that would be the case the light bulb turned on! I didn’t have a Primary Key set on the table. Why I didn’t have...

posted @ Thursday, November 04, 2010 9:58 PM | Feedback (3)

Updating Rows from one table to another without a relationship

So, I’ve been doing a lot of SQL Scripting lately and I’ve come to a stop when I hit a problem I have never hit before. I had to update ColumnA of TblA with ColumnB of TblB. So my initial thought was to do an INNER JOIN UPDATE. So I started typing: UPDATE a SET a.ColumnA = b.ColumnB FROM TblA a INNER JOIN TblB b   And then it hit me. How do I join them? They don’t have any type of relationship. Started thinking and talking to Edgar and decided to use ROW_NUMBER() to join both tables. UPDATE a SET a.ColumnA =...

posted @ Wednesday, October 27, 2010 12:09 PM | Feedback (0)

Geospatial Article Part 1 on Simple Talk

Part 1 of my Mapping Your Data with Bing Maps and SQL Server 2008 article is now published on Simple-Talk. Go read it and learn how to integrate Bing Maps into your existing or new apps to solve business needs. Happy Reading!

posted @ Wednesday, March 24, 2010 5:13 PM | Feedback (2)

Out of Process Session State and LINQ To SQL Entities

When using ASP.NET you can choose 4 different ways of storing session: In Process, State Server, SQL Server, or Custom. When using In Process the session is stored on the ASP.NET thread of the web server, but when using the State Server or SQL Server the sessions are stored outside the ASP.NET thread. When would you use Out of Process session state? Mostly when you have a web farm and you need to share the same session across all web servers. You might choose to use it even if you have one web server for the simple reason of saving...

posted @ Friday, November 13, 2009 11:56 AM | Feedback (2)

SQL Server 2008 Spatial Data and Virtual Earth at Devry

Tomorrow I will be speaking about the SQL Server 2008 Spatial Data and Virtual Earth at Devry for the Miramar.NET user group. It will be a very informal meeting where we will discuss about the new Spatial Data Types in SQL Server 2008, Virtual Earth, and some sample codes and ideas on how to integrate both. The meeting will be held at Devry University Miramar Campus tomorrow (5/12/2009) at 6:30 PM on Room 254. If you are also a student of Devry I recommend you go to room 132 at around 6 PM where I will be speaking to...

posted @ Monday, May 11, 2009 8:29 AM | Feedback (1)

United States Census Data (USCD) for SQL Server 2008

Yesterday I announced my project on CodePlex: uscdsql. Between yesterday and today I finished importing and uploading the Cities and ZipCodes of the 2000 Census. Go ahead and download the data and play with it. I hope you can make your contribution to the project. Happy GeoProgramming!

posted @ Monday, April 20, 2009 4:24 PM | Feedback (0)

US Census Data for SQL Server 2008

I have been playing around with the new SQL Server 2008 spatial data types and Virtual Earth and I must admit that I am loving every single minute of it. Anyway, I’m going to make it short and sweet. I would say that 99% of business applications are data centric and I dare to say that almost every single one of those applications have spatial data one way or another (sales, customers, etc). Having this type of data is great, but to make an application really great and be able to take full advantage of the spatial functionality...

posted @ Sunday, April 19, 2009 11:25 AM | Feedback (2)

Schedule Back Ups with SQL Server Express 2005

One of the limitations of SQL Server Express 2005 is that it doesn't have a built in way to schedule jobs. There are tools out there that let's you run jobs on the express version, but if you're like me who don't like to install a lot of things on your servers then you would try to avoid that route. I was in need of running scheduled back ups of my SQL Server Express databases, but I couldn't find a way to schedule them through any built in SQL Server functionality. A simple search yielded me to this excellent article...

posted @ Tuesday, June 24, 2008 11:54 PM | Feedback (0)

How to Get the Node Name of a Node from and XML Variable in SQL Server 2005

I was talking with my co-worker and data expert John Papa regarding the XML functions within SQL Server 2005. I basically couldn't find a way to get the node name of a specific node for an XML Variable. I hit up google and started searching for a way to get the syntax for getting the node name. I was searching terms like "SQL Server 2005 Xml get node name" thinking there would be a SQL Server function to provide me this information. I was not getting any good results. That's when John told me that SQL Server 2005 uses XPath as much...

posted @ Thursday, January 03, 2008 3:33 PM | Feedback (2)

Sample Repository Posted

For those of you interested in downloading the code for last night's Code Idol session: "Using SQL Server 2005 as a Document Repository" you can do so here. For more details on the code you can also read my previous post on the topic here. The demo requires a table and bellow is the SQL to generate the table:USE [DocRepository]GO/****** Object: Table [dbo].[Doc] Script Date: 10/03/2007 09:12:38 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[Doc](  [DocID] [int] IDENTITY(1,1) NOT NULL,  [DocName] [nvarchar](100) NOT NULL,  [Extension] [nvarchar](50) NOT NULL,  [DocContent] [varbinary](max) NOT NULL,CONSTRAINT [PK_Doc] PRIMARY KEY CLUSTERED (  [DocID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,...

posted @ Wednesday, October 03, 2007 1:07 PM | Feedback (0)

Full SQL Server Archive