sql-server-2008

SSIS - Importing variable format text files

By "variable format" I mean that each row in the text file begins with a single character code denoting the record type, and each record type has a different format. I believe this is some sort of fairly common mainframe data export method. What makes matters worse is the fact that the record types are actually hierarchies. The codes in ...

Using Temp tables in SSIS

I am using a Temporary table in Stored Procedure in SQL Server. I am trying to use that SP in OLE DB Source Editor. I can see the data output returned in the Query Builder that comes with Build Query button. But when i Click the Columns tab, I am getting the below error. Blockquote - TITLE: Microsoft Visual Studio Error at Da...

SQL Server 2008 - Table - Clarifications

I am new to SQL Server 2008 database development. Here I have a master table named ‘Student’ and a child table named ‘Address’. The common column between these tables is ‘Student ID’. My doubts are: Do we need to put ‘Address Id’ in the ‘Address’ table and make it primary key? Is it mandatory? ( I won’t be using this ‘Address Id’ i...

Need some t-sql clarification

This is a follow up to my previous question, in t-sql SELECT SCOPE_IDENTITY() returns a BIGINT, I did the following to get it to return an INT: DECLARE @X INT INSERT ... SELECT @X = SCOPE_IDENTITY() -- if i don't include the line below, it will return a BIGINT SELECT @X Why does it return a BIGINT unless I do SELECT @X at the...

SQL primary key - complex primary or string with concatenation?

I have a table with 16 columns. It will be most frequently used table in web aplication and it will contain about few hundred tousand rows. Database is created on sql server 2008. My question is choice for primary key. What is quicker? I can use complex primary key with two bigint-s or i can use one varchar value but i will need to con...

SQL Server communication protocol issue

Hello everyone, I am using VSTS 2008 + C# + ADO.Net + SQL Server 2008. My questions about what kinds of communication protocols SQL Server 2008 will be using, more details of my questions, If the connection string looks like this, whether Named Pipe or TCP/IP is used? Will different communication protocol being used dependent on wheth...

Will the Sql Server Import And Export Wizard have shapefile support anytime soon?

Do you know? PS: Some of you will tell me to check the Sql Server Management Studio features roadmap. But where is it? ...

Converting varchar to decimal in sql server 2008

I have this data as varchar '00072330'. How do I convert it to a decimal that looks like '723.30' in SQL Server 2008? ...

SQL Full text search with foreign key columns

I have a table (table 1) with couple of column on which i want indexed. There is also ArticleID column (foreign key), with this id I want to use join to retrieve "articleTitle" from the article Table (table 2), and of curse be able to search in this column. How do I create this kind of index? Do I need to index both tables? and how shou...

Sync Services downloads data, but doesn't update local SDF file...

I've setup a local cache of data in my ASP.NET app. I've got the app reading/writing to the local SDF file using the Entity framework. When I issue the sync command: DataCacheSyncAgent syncAgent = new DataCacheSyncAgent(); Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize(); The sync agent pulls down al...

Sql Connection String to named instance

I can connect to my sql server 2008 developer server using this in a sample code project: string connection = @"data source=.\SQLSERVER2008;Integrated Security=SSPI;Initial Catalog=RSINET.MVC"; When I try updating the web.config file like so, I get a sql exception: <add name="ApplicationServices" connectionString="data source=.\SQLS...

SQL update value to highest date in table

I have the following problem: Suppose I have a table with the following fields: [ID] [Start Date] [Status Date] [Status Description] [ID] is not unique, and so I may have: ID Start Date Status Date Status 123 01/01/2009 01/01/2009 Start 123 01/01/2009 01/02/2009 Change 123 01/01/2009 01/03/2009 Change 123 01/01/2009...

OnTaskFailed event handler in SSIS

If I use OnError event handler in my SSIS package, there are variables System::ErrorCode and System::ErrorDescription from which I can get the error information if any things fails while execution. But I cant the find the same for OnTaskFailed event handler, i.e. How to get the ErrorCode and ErrorDescription from the OnTaskFailed event ...

What is the difference between TEMPORARY TABLE and TABLE VARIABLE in SQL 2008?

What is the difference between: CREATE TABLE #temp ( [ID] INT) INSERT INTO #temp SELECT ... and DECLARE @temp TABLE ( [ID] INT) INSERT @temp SELECT ... in SQL Server 2008? ...

How to create DB in SQL Express using SQL commands?

I am reading a book on SQL and it gives me scripts to run to create a database. But I have only SQL Express 10, which doesn't look like has tools to run SQL commands. Is there any way to run the scripts? ...

How do I programatically perform a Modify on all stored procedures in my database in SQL 2008

What I want to do is simulate right clicking a stored procedure an selecting Modify, then execute so that my stored procedure runs. Some of the tables in our database have changed and not all the sp's have been modified. ie old SP = ALTER PROCEDURE [dbo].[myProcedure] SELECT name, address, typename from names GO Then the names tabl...

Using SMO, still no go... ConnectionContext.ExecuteNonQuery(script) can't understand "GO"

Hello! SQL Server 2008 Using all the correct references I dare say: System.Data.SqlClient; Microsoft.SqlServer.Management.Smo; Microsoft.SqlServer.Management.Common; Microsoft.SqlServer.Management.Sdk.Sfc; All compiles with no errors. I have stripped code down to almost zero for easy debugging. Connecting to server alright and so o...

SQL express 2008 restore from a SQL Server 2008 backup

I have done some research online but i cant seem to find a proper answer. I am trying to restore a SQL server 2008 backup onto a sql express 2008 system (Live environment backup to Development environment) The problem is i keep getting a "SQL Server cannot process this media family" error code 3241. Any ideas??? Thanks ...

SQL Server 2008 NOT IN() seems to fail

Hey guys, I am building a suggestive tagging system (sounds seedy), I pass in a string to the db and if there is a match it sends back that tag. I want to stop duplicate tags, so if one tag is WEB, I only want it to be returned once. So if I had WEB as a tag and then add WEEKLY, typing "WE" doesn't bring up WEB for a second time as a s...

Storing Multi Choice Field into in SQL Server 2008

I'm writing an app in .NET, and using a dropdown checkbox. I'm not sure what the best practice is for storing this info in the db. Currently I'm writing back a comma delimited string to an SP in SQL Server 2008 ie "apple, banana, pear", storing this in a nvarchar(MAX) and then splitting this in the SP into another table holding the ID ...