sql-server

ASPNet EMail attachment from SQL BLOB

We are storing scheduled email information in SQL Server 2005. Included in the email information are 0 - 3 attachments of varying filetype. I have a VB.net Windows service that runs 'x' number of minutes, populates a dataset with the email info from SQL Server, builds the emails, and sends them via ASPNet EMail. Trying to build and add ...

What do you think the future holds for database technology?

The good old Relational Database Management System (RDBMS) has been around for quite some time now and is still, certainly in my opinion, the mainstay of the majority of production platforms/software applications. Recently there seems to be a great deal of hype in the community regarding relatively young database technologies such as Cl...

How can I update my SQL Server database schema?

Usually throughout development of a project I will deploy frequently, just to make sure I wont have any problems in production. Also, throughout development, I find myself changing the database's schema. How can I easily update the database in production? I have been dropping the old database and reattaching the new one. Is there a fa...

What does a transaction around a single statement do?

I understand how a transaction might be useful for co-ordinating a pair of updates. What I don't understand is wrapping single statements in transactions, which is 90% of what I've ever seen. In fact, in real life code it is more common in my experience to find a series of logically related transactions each wrapped in their own transa...

Database vs. Front-End for Output Formatting

I've read that (all things equal) PHP is typically faster than MySQL at arirthmetic and string manipulation operations. This being the case, where does one draw the line between what one asks the database to do versus what is done by the web server(s)? We use stored procedures exclusively as our data-access layer. My unwritten rule ha...

Using OpenID for website Authentication

I'd like to implement OpenID in a new application using ASP.NET 2.0 and SQL Server 2005. I chosen Twitter, Facebook and Google as potential OpenID providers. I've found the Twitter implementation in .NET and I was studying Google's OpenID implementation, but I want to make sure that my design is (mostly!) flawless. Is my database sch...

Joining Tables from multiple SQL Server databases located on separate severs

What is the recommended way of joining SQL Server database tables located on databases which are on different servers? All databases will be on the same network. ...

SQL: creating a string array and query = like all strings in array

I have SQL Server 2005 Report that takes a parameter in a query string that searches customer names. The problem is some customers like to put in a middle initial so when the user 'John Smith' this does not bring up 'John Q. Smith'. Using only sql, how would I split a string into an array by whitespace then search records matching each ...

setting content to be viewable by friends only

Hi, Say I have a table that holds content: Content(contentID, title, body, privacyType) Privacy type can be: Public = 1 (anyone can view it) Private = 2 (only the author can view it) Friends = 3 (only friends can view it) I have a users table: Users(userID, username) THen I have a mapping table for the users friends: Friends (use...

Incremental count column based on another column contents

I need to populate a column with the running count based on another column contents. The table is like this: count seq_num 1 123-456-789 1 123-456-780 1 123-456-990 2 123-456-789 2 123-456-990 So, as the seq_num column changes, the counter restes to '1' and as the co...

Guidelines for creating additional full-text catalogs

The nice wizards says If this is a large table or view, or if the chosen full-text catalog has indexed or other large tables, consider assigning this table or view its own full-text catalog "Large" is a pretty subjective term, is it 1000 records or 1,000,000 in a table? What guidelines do you follow when creating additional full-t...

Updating a Type-2 Dimension with the MERGE command

I am managing a data warehouse. I have several dimension tables most of which are type-2 and some are type-1. I was able to figure out how to use MERGE to maintain my type-1 dimension tables. I am stumped on how to do the type-2 dimension tables. How do I do both, the update to the EndDate and an insert using the MERGE Command? ...

Imply bit with constant 1 or 0 in SQL Server

Is it possible to express 1 or 0 as a bit when used as a field value in a select statement? e.g. In this case statement (which is part of a select statement) ICourseBased is of type int. case when FC.CourseId is not null then 1 else 0 end as IsCoursedBased To get it to be a bit type I have to cast both values. case when FC.Course...

.Net 2.0 & SQL Server 2008 Hanging Process

I created a simple .Net web service which runs a very simple query (which should normally be very quick). The query is something like this: SELECT v.email FROM dbo.Reporting r INNER JOIN dbo.Reporting_EmailList el ON r.reportID = el.reportID INNER JOIN OtherDB.dbo.V_ActiveDir v ON el.userGUID = v.objectGUID WHERE r.reportID = @repor...

New object in the Entity Framework - problems with primary key

In my database I have a Vehicle table with a primary key. I am creating a new Vehicle object using new Vehicle(); and updating the properties of vehicle appropriately. When I try to do a genesisContext.Vehicles.AddObject(vehicle); The first time the table is successfully updated and the primary key is 0. On all subsequent occassion...

How To Forward Data To An External System If There Were Changes During An INSERT or UPDATE? Use a Trigger? Use Extended Sproc or CLR Integration?

Here's the basics of the system we have in place today. We have a SQL 2005/2008 table defined as: CREATE TABLE [dbo].[Profiles] ( [Firm] [char] (4) NULL , [Account] [char] (10) NOT NULL , [UndSym] [char] (24) NOT NULL , [Updated] [timestamp] NOT NULL , [Data] [image] NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] ...

SQL Server: Normal Index vs. Fulltext Index

Hello, what exactly is the difference (and advantages/disadvantages) between a fulltext index and a regular index on a varchar column? When would I use which index? I have a multitude of varchar columns (addresses - city name, street name etc.) which I need to be searchable in the most performant way and I'm trying to figure out which i...

SQL Server: Access Fulltext Index via LINQ

Hello, is there any way to instruct LINQ to run a Fulltext Index Query (such as CONTAINS)? Any text search queries LINQ is currently building for me are only ending up with the LIKE operator. Do I need to create a stored procedure for this? An example would be fantastic! Thank you! ...

Updating records with SQL statement that are in 2 diff. tables not working.

This is my SQL Statement UPDATE sysdba.CONTACT, sysdba.ADDRESS SET sysdba.ADDRESS.Address1 = '123 Tech Parway' WHERE sysdba.CONTACT.AddressID = sysdba.ADDRESS.AddressID AND sysdba.CONTACT.contactID = 'CRBD' What is wrong here? Thanks in advanced! EDIT: Using SQL Server 2005 ...

Sql Server 2008 Replicate Synonym?

I plan on updating some table names by create a synonym of the old name and renaming the table to what I want it to be. Can replication properly reference a synonym? Also as a side question, is there an easy way to see if a specific table is actually being replicated? (via a query perhaps) ...