SQL Server 2008

You are currently browsing articles tagged SQL Server 2008.

A while ago I had been playing a bit with the new spatial data types in SQL Server 2008.  Not only can SQL Server store such data, it can also visualize it.  So I had come up with the following query:

select geometry::STPolyFromText
('POLYGON((1 1, 1.5 1.85, 2.5 1.85, 3 1, 2.5 0.15, 1.5 0.15, 1 1),
(1.5 1.5, 1.5 0.5, 1.7 0.5, 1.7 0.9, 2.3 0.9, 2.3 0.5, 2.5 0.5, 2.5 1.5, 2.3 1.5,
2.3 1.1, 1.7 1.1, 1.7 1.5, 1.5 1.5))', 0);

Running that in the Management Studio produces something like this on the Spatial results tab:

Hoegaerden - the polygon

I’m using the STPolyFromText function to produce a six-sided polygon with a letter H in the center.  To get to the result, I’m passing a bunch of XY coordinates to the function.  A line gets drawn between two coordinates following each other.

The first list of coordinates (the first list of numbers enclosed in round brackets) creates the hexagon while the second list produces the letter H.  Each list of coordinates thus represents one polygon.   The starting XY coordinate must be equal to the ending coordinate to form a closed shape.  The shape is then filled with a color.  Overlapping shapes will be filled using different colors, as shown above.

Producing these coordinates was quite interesting: to be able to calculate the angled sides of the hexagon I used the following formulas.

With S being the length of one side:

Width = 2 * S

Height = S * SQRT(3)

Note: these formulas are only applicable when the hexagon is rotated as shown above.

I needed to know these distances to be able to calculate how much I should increase the X/Y coordinates to get to the next connector.

Okay, enough theory, back to the story now.

Q: “So, why are you creating a helipad platform?”

A: No, it’s not supposed to look like a helipad platform.  The shape resembles the beer coasters for the beer called Hoegaarden.  And those coasters always have a funny drawing or comment on them.  Let’s see if I can find one that’s understandable for non-native Dutch-speakers…

(And half an hour later – turns out it’s really not easy to find one without text – luckily they’ve also created some in English!)

Hoegaarden beer coaster

Initially I was planning on writing a longer article about the spatial data types but hadn’t found the time to do it yet.  And then a couple of days ago I came across a challenge that made me think of this query and so now I’m publishing it in this post.

The challenge to which I’m referring was started by Itzik Ben-Gan and is called Geekiest Sig Challenge.  The point is to use the new SQL Server spatial data types to create a signature for yourself.  Well, a perfect description for my query!

I was happy to just get an H on there, getting those coordinates right without first putting it on paper is really a challenge :-)   And on top of that, I was never any good at drawing.  I remember in secondary school we got an assignment to draw a tree.  Any tree.  So at home I looked out the window and started drawing the tree.  I ended up with the most atrocious thing I’d ever seen (well, that may be a bit exaggerated), it could have starred in a Hitchcock movie straight away, really spiky, and probably spooky when encountered in the dark and with the right background noises playing.

Anyway, what I wanted to say, some people are just talented: check out this submission by Michael J. Swart!  No further words needed.

Right, enough geeky stuff to close the week, and remember: have fun!

(Hmm, now I’ve got something to build my favicon from…)

Valentino.

  • Share/Bookmark

Tags: , , ,

If you’re interested in seeing the next Service Pack for SQL Server 2008 released, vote for it at this Microsoft Connect page!  Now that the release date for R2 has been announced, hopefully the next one is for SQL 2008 Service Pack 2.

If you’re still on 2005 and thus more interested in an SP4 for that version, it has also been posted at Connect.

How did I find out?  Through the following blog posts at SSQA.NET:

SQL Server 2008 SP2

SQL Server 2005 SP4

Update (27 Feb 2010):

SQL Server 2008 SP2 is scheduled for Q3 2010.

SQL Server 2005 SP4 is scheduled for Q4 2010.

See this post on the Microsoft SQL Server Release Services blog for details.

  • Share/Bookmark

Tags: , ,

Ever since I upgraded to SQL Server 2008 Service Pack 1 I noticed that the Management Studio was reporting incorrect version numbers when connected to Integration or Reporting Services.  This incorrect version number is located to the right of the server instance in the Object Explorer.

As usual, a picture says so much more than … :

Object Explorer showing wrong version numbers

As I have posted earlier, 10.0.2531 is the version number for SP1, while 10.0.1600 is the original RTM version number.

I never really spent time looking for an answer to this.  It was obviously a bug but I could live with it and someone else would probably already have filed it as being a bug.  So recently I came across a post by Phil Brammer that mentioned this issue.  This post got a comment from Matt Masson, a developer on the SSIS team.  Have a look at the comment but in short: the version numbers that are being shown in the Object Explorer are actually the version numbers of the service’s .exe file!  And SSMS is now showing the wrong number because these files didn’t get an update in SP1.

After a little search I found the bug report on Microsoft Connect, reported on March 11, 2009, by Dan English.  Its status is Fixed but it seems that it isn’t.  At least, looking at the comments, CU5 (Cumulative Update) for SQL Server 2008 SP1 is still showing the problem.  So I guess you could go over to the Connect page and click on that Yes button if you’re interested in seeing this fixed.  After all, it could be quite misleading to novice DB guys and gals…

On this same subject, there’s another interesting post by Adam W. Saxton, a member of the Microsoft SQL Server Escalation Services Team.  In this post he takes a closer look at the SQL Server 2008 Reporting Services version number after having installed CU2.

Conclusion: if you need to find out what version your server is running, do not rely on the version numbers that you see in the Object Explorer.  As Adam explained, one way is to look at the version numbers of the files that were included in the upgrade.  But that may a bit of an overkill.  My favorite way, assuming that all components of the SQL Server installation have been upgraded to the same version, is to use the following query:

SELECT @@VERSION;

 

On my machine that comes back with the following result:

Microsoft SQL Server 2008 (SP1) – 10.0.2531.0 (Intel X86)   Mar 29 2009 10:27:29   Copyright (c) 1988-2008 Microsoft Corporation  Developer Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 3)

And remember, have fun!

  • Share/Bookmark

Tags: , , , , , , , ,

I came across an issue when playing around with Report Builder 2.0.  I had created a report using an embedded data source.  Once I’d published the report to the report server, I couldn’t get it to run anymore.  Instead it gave me the following error:

This report cannot be run in report builder because it contains one or more embedded data sources with credential options that are not supported.  Instead of embedded data sources use shared data sources or save and view the report on the server.

Okay, no problem I thought, let’s just create a shared data source and switch to that one then.  So I opened up the Data Source Properties in Report Builder and selected the Use a shared connection or report model radio button.

Unfortunately, when running the report it threw me that same error?!  And when I open the Data Source properties again, my change was undone!  It was still using the embedded data source.

As far as I’m concerned that should be a bug.

The only way that I could switch my data source to a shared connection was by creating a new data source, which means you also need to move all datasets connected to the original data source.

Quick tip: if you first rename the original data source and datasets to something like srcMyDataset_OLD, you can give the correct name to the new one straightaway.

So I guess that’s another workaround on my list :-)

This issue was encountered while using Report Builder 2.0 (10.0.2531.0).  I tried to reproduce it using Report Builder 3.0 (10.50.1092.20 – that’s the version of the SQL Server 2008 R2 August CTP) and I couldn’t.  Which means it has been fixed.  Good on you Microsoft!

  • Share/Bookmark

Tags: , , , , , ,

Now that the European Elections are over once again, I’d like to draw your attention to another request for voting.

Using Reporting Services 2008, at this moment it is not possible to link two datasets.  Linking datasets would be really interesting in certain cases.  Imagine you’ve got two datasets, used in two different report data regions.  However, your second data region needs data from the first dataset as well.  As you probably know, a data region can only be bound to one dataset.  Both datasets contain an identical identifier so in theory they could be perfectly linked, if only the IDE would allow it.  Linking two datasets should result in a third dataset that behaves exactly the same as a regular one, which would allow us to bind that one to a data region.

Here’s a small example to clarify the above:

Dataset 1 consists of col1, col2.

Dataset 2 consists of col1, col3.

col1 is an identifier.

If you could tell SSRS to join dataset 1 and dataset 2 on col1, resulting in:

Dataset 3: col1, col2, col3

that would be really great!

This has several benefits:

  • the data is already available in another dataset, why load it twice ?
  • performance: in certain cases combining the two queries into one would result in a slower query (I’m thinking of situations where the database design is not optimal and you’ve got no control over it – sounds familiar ?)
  • developing reports would become an even nicer experience (no need for workarounds such as this one)
  • if Crystal Reports and others can do it, why shouldn’t SSRS be able to do it as well ?

If you Google around (or should I say Bing around ?), you can see that I am certainly not the only one with this question in mind.  In fact, someone has already posted a request on Microsoft Connect and a Microsoft representative said the following:

Thank you for your suggestion.
We are indeed considering adding this kind of functionality in a future release of Reporting Services. We are also monitoring the customer vote count on this particular suggestion to gauge the relative community demand compared to other suggestions.
Thanks,
Reporting Services Team

So if you’d like to see this feature implemented in Reporting Services, click this link and vote!

  • Share/Bookmark

Tags: , , ,

If you’re using Integration Services 2008 and the Foreach Loop Container in the Control Flow, you’ll very likely encounter this bug.

The Foreach Loop has several enumerators available.  By default it selects the Foreach File Enumerator.  However, as the screenshot below shows, there’s no way to configure it – the Enumerator configuration group just shows blank space.

Foreach Loop Editor with empty Enumerator configuration

This phenomenon is caused by a bug which has been reported on Microsoft Connect.  The workaround, if you really need the File Enumerator, is to select another enumerator first and then switch back to the File Enumerator.  You’ll notice that the regular controls show up and on you go, define that folder name!

  • Share/Bookmark

Tags: , , , ,

Lately I had been getting annoyed by Visual Studio crashing on me while working on ETL packages.  The crashes seemed somehow related to debugging a package because they usually occurred after I clicked the “Package execution completed. Click here to switch to design mode, or select Stop Debugging from the Debug menu.” link.  But I couldn’t really pinpoint why or when exactly they occurred.  Now I’ve got an explanation, and a solution!

How did I get to the solution?  Well, today I decided to click the “Send to Microsoft” button on the infamous crash pop-up window.  And from it I actually got a link to a fix for the issue.  Apparently the issue is not related to Integration Services in particular, it is a much broader Visual Studio shell issue that occurs in Visual Studio 2008 with SP1 when you’ve got a combination of undocking windows and changing window layout.  And that is indeed what I usually do when debugging a package!  When the package stops executing I often execute the following scenario:

  • double-click the title bar on the Output window to undock it
  • enlarge the undocked Output window to almost full-screen so I can have a good look at the errors
  • double-click the title bar to dock the window back to its original place
  • click the “Package execution completed.” link (or hit the Stop Debugging button)

And that’s exactly the second scenario described in this Microsoft Support article because when you stop debugging, the IDE switches the window layout back from debug to design.

I have now installed the hotfix and the issue is gone.  Beware though if you also use WPF, better read through the whole article and comments on the download page first.

Hmm, this may also explain some other unexplicable crashes I’ve seen lately.  Makes you wonder doesn’t it :-)

  • Share/Bookmark

Tags: , , , , , , ,

10.0.2531.0

Right.  10.0.2531.0.  That’s the version number that my SELECT @@VERSION statement is reporting when executed on my SQL Server 2008.  How come?  Well, I installed Service Pack 1.

In other words, SP1 for SQL Server 2008 is out and can be downloaded from the Microsoft Download Center!

Besides fixing several bugs there are some new features to the installation package itself:

  • Slipstream
    You can now integrate the base installation together with service packs or with hotfixes. Therefore, you can install in a single step.
  • Service pack removal
    You can now uninstall only the service pack without uninstalling the whole instance.
  • ClickOnce capability
    You can now deploy Report Builder 2.0 by using the ClickOnce deployment technology.

I especially like the slipstream feature.  This should wipe out a problem which I encountered with 2005.  Some time ago I got a machine that had SQL Server 2005 installed, including SP2.  However, the Management Studio was not installed.  Ever tried getting it installed in such a scenario?  The install DVD complains that there’s already a newer version on the machine and refuses to install SSMS.  So I ended up uninstalling and reinstalling everything.  This problem should now be avoidable, or at least, that’s what I hope.  I haven’t actually tried it out but that’s how I understand slipstream.

Together with SQL Server, the Express Edition of 2008 has also gotten an update to SP1.  And the same goes for the SQL Server 2008 Feature Pack which is now dated April 2009.

Other updated downloads include Report Builder 2.0, Data Mining add-ins for Office, Reporting Services add-in for SharePoint and the Upgrade Advisor.

Update: the BOL have gotten their update as well.  Now available for download: Microsoft SQL Server 2008 Books Online (May 2009).

  • Share/Bookmark

Tags: , , ,

Once upon a time in a Business Intelligence Development Studio 2005 Reporting Services solution there liveth a Textbox object which developers could use to put text on a report.  It was a fairly simple object, allowing only two ways of programming the text.

The first and most simple way of the two was to type plain and simple text directly into the box:

SSRS Textbox with simple constant text

And the second, more advanced way, alloweth developers to use an expression to create the text dynamically.  With this they could combine data from several sources into the same Textbox:

SSRS Edit Expression window

Then developers realized that something was still missing.  Text could be created dynamically but they also wanted to optimize the way the text looketh.  So they selected part of the expression and tried to change some font properties.  But alas, they couldn’t.  It was all or nothing:

Text rendered using some font styles in SSRS 2005

Then arriveth the day of the birth of the successor to BIDS 2005.  As the family’s tradition went, it was called the same as its parent.  The only difference was its birth year: BIDS 2008.

And developers started exploring BIDS 2008 and discovereth that the Textbox object had gotten an upgrade.  When editing the content of the textbox, the right-click menu has gotten a new item:

SSRS 2008 Create Placeholder menu item

That’s right, Create Placeholder.  And this was the moment in time when developers started to have fun again.  The placeholder can be given a value through an expression, just like the olden days:

Placeholder Properties - General tab

The Placeholder’s value can be given a format through the Number tab:

Placeholder Properties - Number tab

And a Placeholder’s font can be customized:

Placeholder Properties - Font tab

Now you may ask yourselves, wherein lies the difference with the olden days?

Well, it lies in the fact that several Placeholders and regular constant text can all be combined in the same Textbox!

This is what it looks like in Design time:

SSRS 2008 textbox with placeholders

And rendered in Preview:

SSRS 2008 Preview of textbox content

Powertip: to easily open up the properties of an existing Placeholder, single-click the Textbox to select it, again single-click to edit the content, then double-click a Placeholder to get its properties window.

When reports developed using BIDS 2005 are attached to a 2008 SSRS solution, any expressions in textboxes are acting as a placeholder as well:

Textbox with expression converted to BIDS 2008

And developers liveth happily ever after.

Although not entirely.  Try entering a chemical formula in the textbox.  Indeed, there’s no subscript option in the font settings.  And it doesn’t work through HTML either, as explained in this Microsoft Connect bug report.  It’s probably not as easy as it sounds, but if Word can do it I think so should SSRS.

Small update: a colleague recently had an interesting idea related to the subscript issue.  If subscript is not possible, try putting the numbers in a smaller font than the other characters.  So instead of H2O, it would become H2O.  The subscript version looks like this: H2O.  The workaround doesn’t look as good as with subscript but better than just in regular font size.  (Thanks Bart :-) )

  • Share/Bookmark

Tags: , , , , ,

If you have installed SQL Server 2008 without making any modifications to the default service settings and you’re trying out the AdventureWorks2008 sample database, you may be getting some similar errors as the following in the Application event log:

A fatal error occurred during a full-text population and caused the population to be cancelled. Population type is: FULL; database name is AdventureWorks2008 (id: 7); catalog name is AW2008FullTextCatalog (id: 5); table name ProductReview (id: 354100302). Fix the errors that are logged in the full-text crawl log. Then, resume the population. The basic Transact-SQL syntax for this is: ALTER FULLTEXT INDEX ON table_name RESUME POPULATION.

The same errors are logged in the \MSSQL10.SQL2008\MSSQL\Log\SQLFT0000700005.LOG log file.  Here you also get an error number: Error: 30059, Severity: 16, State: 1.

I have seen the issue occur when the SQL Full-text Filter Daemon Launcher service was running with the NT AUTHORITY\NETWORK SERVICE account.  Switching the service to use the Local System account solved the issue.  Then the Full Text Catalog would rebuild without any issue.

To rebuild the Full Text Catalog in Management Studio, open your database in the Object Explorer, under Storage > Full Text Catalogs there’s an entry called AW2008FullTextCatalog (in the case of the sample DB).  Double-clicking this shows the Full-Text Catalog Properties.  Select the Rebuild catalog radio button and click OK to rebuild the catalog.

Alternatively you could execute following statement on the AdventureWorks database:

ALTER FULLTEXT CATALOG [AW2008FullTextCatalog] REBUILD;

After waiting for about 15 seconds (there’s not a lot of data to be indexed) if you open the properties again you should see the Last Population Date filled in with the current timestamp.  Another way to tell if it was successful is to look at the FT log file, error 30059 should not be mentioned anymore.

Or try using a Full Text query:

select * from Production.ProductReview
where contains(Comments, 'heavy');

This should output two records.

  • Share/Bookmark

Tags: , , ,

« Older entries

© 2008-2010 A Developer's Blog All Rights Reserved