I have just installed Sql Server Compact Edition. To my surprise, we can't use stored procedure in sql server CE. Do I have any alternative of Stored Procedure in Sql Server CE.
I am strongly obsessed 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.
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.
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
You will have to use inline sql in your application. Use SqlCeCommand.CommandText Property to specify sql text.
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.
Related
Imagine I am creating a Winforms app, using WCF I connect the same to SQL Server. I would be creating stored procedures in SQL Server.
My scenario here is as I release updates for my app over time...like ver 1.0, ver 2.0...v.n...
I might then need to modify my stored procedures. But I can't do that as it might affect users using the earlier version of the app. Hence I might need to create new stored procedures for the newer versions over time.
So I would want to know what is the best naming convention for my stored procedures? Can I name them something like sp_name_1_0, sp_name_2_0 and so on? It would have been much easier if there was some kind of grouping possible for stored procedures in SQL Server like folders...
Let me know what the best way is!
Thanks,
Sarin Gopalan
I have two SQL Stored Procedure. One from test environment and other is on the production. I have to check that whether there is any change in the stored procedure on the production environment.
Is their any way I can find the difference?
Many Database compare tools exist out there like red-gate's sql compare
Comparing SPs is easy: you can use the sys.procedures view and the object_definition() function get the SP source and compare this.
You can of course also use any tool which is able to script and/or compare database objects.
The open-source bsn ModuleStore database versioning toolkit can also compare this for you at runtime.
Have a look at SQL Compare from Red Gate
I use Adept SQL Diff for such things.
Visual Studio 2008 (and possibly 2005, not sure) has a database schema compare tool, although I think it's only included in the database edition of the IDE.
I have a SQL Server stored procedure which has been in use for years. This stored procedure calls lots of other procedures. I would like to extract each inside procedure one at a time and implement its business logic to a .NET Class project.
In order to do that, I have to call .NET assembly from parent stored procedure and the returned result will be used by parent procedure. Since SQL Server 2005 and higher has CLR integration, so I think, executing .NET assembly inside stored procedure [or any Database objects] should not be a big deal, can you please point me some references where i can find examples or article to implement it?
Thank you very much for your help .
I really feel that this would be an inappropriate use of SQL CLR. The purpose of CLR integration is to support complex data types and operations that are normally very hard to do in pure SQL (such as sequences, regular expressions, hierarchy, geospatial, etc.) Not to implement a domain model in your database.
Domain models and business logic are separate from relational/data models. They should be in a proper business tier of some sort. Don't hack them into a database using the CLR.
(Note: I use SQLCLR a fair bit. I am not railing on CLR integration. I just don't think that this question reflects a wise design decision.)
MSDN
Building my First SQL Server 2005 CLR
An Intro to CLR Integration in SQL Server 2005
For loads more ;)
I think you should use SQL Server Integration Services (SSIS). As far as I understand, it solves this case, to orchestrate the procedure calls and gives you much more too..
I'm not too sure if moving this decision outside the db layer is a good decision.
Hope it helps..
In MS SQL Server 2005, how can I create a script consisting off all the objects in the database (tables, stored procedures, views)? I want to use the script to create the database using SMO or to update its objects (alter, drop) if they already exist. I know about the scripting feature in SQL Server Management Studio, I am however not familiar with the configuration options.
If versioning your database schema is what you're getting to, try Wizardby. Although it does not directly support neither views nor sprocs, it supports running native SQL scripts as part of an upgrade/downgrade process.
I use Easy Sql Tools. The deploy version is free. You can generate scripts from schemas, data, indexes, almost everything.
http://www.easysqltools.com
There's a great tool SQL Compare that will actually compare two databases and create a change script for you. It's a great tool for staging purposes. There's also SQL Data Compare tool that will also compare lookup tables and act accordingly.
The downside is, they're not free. :(
We have a very complex set of stored procedures that have been migrated over from Oracle in to SQL 2005. At one time, I heard there was a solution where sequence diagrams could be created from either watching a stack trace in VS or by the SQL profiler. I've searched long and hard and have found may tools that will create sequence diagrams of your code, but not the DB interaction. Is anybody aware of a set of tools that maybe able to help me out.
I can stand up many different environments including SQL 2005, SQL 2005, VS 2005, VS 2008.
I'm not aware of any, but you could add a call-log table with a timestamp and sp/function name, and have each sp & function log its activity.