Aug 10, 2009

Generate scripts to export table data.

In SQL Server 2008, you can export the data in the table as SQL scripts and execute it on other DBs for importing it. This can be done from the right click menu option "Tasks" + "Generate Scripts" and setting "Script Data" attribute to true. The wizard allows selection of tables to export data from and generates a script that both creates the table as well as inserts the data into the newly created table.

This will be extremely useful to me, as our team is spread across geographic locations tweaking the db everyday!

Thanks for the short post from Mitch.
Reblog this post [with Zemanta]

when to use varchar(max)?

When to use the 'max' keyword in the varchar or nvarchar data type?

Following are the points to consider while making the decision:

Without 'max':
- The max storage requirement for your field is fixed.

- The storage space is allocated whether you use it or not, resulting in unused bytes across the db.

- Performance could be better as the db need not do additional processing to determine data size (unlike the case of using 'max').

Using 'max':
- The storage requirement for your field need not be predefined (max permitted size depends on the DB though)

- DB allocates only the amount of space required by the data stored in the data type and increases space as needed. This is achieved by the DB internally through use of pointers and TEXT datatype to dynamically allocate and conserve space.

- Through max, you keep the business rule(related to data length) away from the data store, thereby allowing flexibility in business rule as far the data storage requirement is concerned. If you need to change the max length of the phone number or the first name a couple of years into your live app, you can just tweak that constant variable in your business logic to get it done, instead of trying to change the attribute of a table column and dependent changes(assuming your db allows that).

- Your may have performance issues due to the additional intelligence that db applies dynamically to calculate the space required.

Overall, it's the difference between the cost of storage and processing. It's interesting, how much work has gone behind supporting the keyword 'max' that started from SQL Server 2008. Kudos to the engineers!

Reblog this post [with Zemanta]

Schema Compare does not support SQL Server 2008

If you are getting the error "Schema Compare does not support SQL Server 2008" while attempting to compare two dbs on a SQL Server 2008, then you are not alone.

The fix is to get the RC1 of the Visual Studio Team System 2008 Database Edition GDR from Microsoft download URL here.

Also, make sure you have the Visual Studio 2008 SP1 installed.

Hope this helps!
Reblog this post [with Zemanta]

Jul 16, 2009

ResourceDictionary value out of range in silverlight 3 RTW

I am porting my SL 3 beta code to RTW.
After a bit of tweaks, i got past build errors. Refer to other post. And then started getting the following runtime error:

Attribute "MyAssembly;component/MyStyles.xaml" value is out of range. [Line: x Position: y]

The corresponding line in the XAML below. Position y is the equal sign after TargetType.
  • style key="ImageButton" targettype="Button"
The following is the code for MergedDictionaries reference
  • resourcedictionary source="MyAssembly;component/MyStyles.xaml"
The actual cause was the Build Action property of XAML file.
The solution steps are
1) the xaml file you are referencing should have BuildAction = Resource
2) addition of a "/" prefix to the assembly in the source:

You can read more in these links:
http://silverlight.net/forums/t/111475.aspx

http://silverlight.net/forums/p/108647/251577.aspx#251577

Also, check the section
"3.18 Effects Files (.ps) can no longer be loaded as Content"
from the list of SL3 RTW breaking changes @ http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Jul 11, 2009

Silverlight 3 RTW - Breaking Changes from 3 Beta and SL 2

Go through the link to understand all the breaking changes from SL 3 Beta and SL 2 before converting your code.

http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Silverlight 3 SDK - Removed Controls

Silverlight 3 RTW removes some of the controls from the SDK. Following are some that were throwing errors in my code.

DockPanel
Expander
HeaderContentControl
ViewBox
WrapPanel

Read this link for the complete list of controls that have moved from the SDK to Silverlight Toolkit.

System.Web.Silverlight not found in Silverlight 3 release

With Silverlight 3 RTW in the wild, i tried running my existing Silverlight 3 beta code with the RTW with anticipations of broken code. I wasn't wrong. Got the first one.

The type or namespace name 'SilverlightControls' does not exist in the
namespace 'System.Web.UI' (are you missing an assembly reference?)


After a bit of searching on my system, i realised it was still referring to my Silverlight 2 libraries path. But, having uninstalled that, unresolved namespace.

After searching on the web and silverlight.net site, found out that, the "System.Web.Silverlight.dll" has been moved out of the Silverlight SDK and made available separately as ASP.NET Server Controls here. So, the fix is to get the dll from here and add it to your project as a library. There could be other ways such as installing to GAC etc, which wasn't really needed in my case.

Hope this helps.
Reblog this post [with Zemanta]