views:

446

answers:

4

I have just installed Sql Server Compact Edition. To my surprise, we can'nt use stored procedure in sql server CE. Do I have any alternative of Stored Procedure in Sql Server CE. I am strongly obseesed with stored procedure, I can'nt think of an application without stored procedures.

Please help, Thanks in advance.

Edit: Can I use Managed Stored Procedures.

A: 

I don't really know what is supported by SQL Server CE, but UDFs can often be substituted for stored procedures. If that doesn't help, try calculated columns and/or indexed views. If those are not available as options, then I think you are stuck with putting the logic in your application.

RedFilter
None of these things are supported in SQL CE. Think of it almost as an XML file with enforceable relationships.
Aaronaught
Ah, "think of it as a persisted DataSet" would be more accurate with "writable tables".
AMissico
@Aaronaught: and some indexes, I would hope?
RedFilter
Limited indexes - no include columns, similar to what we got in SQL 2K. AMissico is right, it's more like a persisted `DataSet` than XML. It's really the bare minimum you could possibly expect from a database.
Aaronaught
+2  A: 

SqlCe is a local database for use by an application. There is no need for stored procedures since the database is just a local data store, and the business logic is in the application. It is not an engine. If you need an engine then use SqlExpress or its big brother. See Steve Lasker's Comparing SQL Server Express and Compact Editions Whitepaper at http://download.microsoft.com/download/A/4/7/A47B7B0E-976D-4F49-B15D-F02ADE638EBE/Compact_Express_Comparison.doc. It explains everything you need to know.

No, you cannot use managed stored procedures. SqlCe is in-process.

Also, you might find Data Storage Architecture with SQL Server 2005 Compact Edition at http://msdn.microsoft.com/en-us/library/bb380177(SQL.90).aspx helpful.

AMissico
Thanks a lot for providing me the link to this paper.
vaibhav
A: 

You will have to use inline sql in your application. Use SqlCeCommand.CommandText Property to specify sql text.

Giorgi
A: 

This blog from Steve Lasker describes how you can implement something similar to sprocs on SQL Server Compact: http://blogs.msdn.com/stevelasker/archive/2008/02/11/stored-procedures-and-sql-server-compact-the-great-debate.aspx

ErikEJ