sql-server-2005

TSQL Help (SQL Server 2005)

I have been playing around with a quite complex SQL Statement for a few days, and have gotten most of it working correctly. I am having trouble with one last part, and was wondering if anyone could shed some light on the issue, as I have no idea why it isnt working: INSERT INTO ExistingClientsAccounts_IMPORT SELECT DISTINCT cca.Accoun...

Optimal way to convert to date

I have legacy system where all date fields are maintained in YMD format. Example: 20101123 this is date: 11/23/2010 I'm looking for most optimal way to convert from number to date field. Here is what I came up with: declare @ymd int set @ymd = 20101122 select @ymd, convert(datetime, cast(@ymd as varchar(100)), 112) This is prett...

SQL Server Fulltext search yields no results

I have SQL Server 2005 Express Edition with Advanced Services. I enabled FullText and created a catalog as follows: create FullText catalog MyDatabase_FT in path 'mypath' as default I then created a FullText index as follows: create FullText index on Cell (CellName) key index PK_Cell with CHANGE_TRACKING AUTO I executed the fol...

Should a data warehouse developer know Powershell scripting?

I am a SQL Server (2005 & 2008) data warehouse developer (SSIS, SSAS, SSRS, SQL) and I am wondering if it would be worth the effort and time to learn Powershell scripting. Are there applicable uses from a development perspective? I understand that from a DBA view there is considerable power in Powershell for administration - does any o...

Which inserts faster, XML field or Varchar(max) field?

We have a history table that stores xml web service requests and responses. Currently it stores them into an XML field, but we're having performance issues with inserts. We only insert records, no updates, selects or deletes. We've truncated the table and rebuilt the index, to no avail. The table has a Primary clustered index on the ...

I need to convert my Mysql database to SQL Server 2005 database

I need to convert my Mysql database to SQL Server 2005 database, Is there any tools available for this conversion. ...

SQL Server 2005 and 'General network error'

I know there is a lot of information in the Internet about solving this problem, but it didn't help me. My Delphi application uses dbExpress controls to access the database and execute SQL queries. Once every couple of days, however, it stops working because the database connection fails. This happens on several different computers wit...

In SQL Server, how to move/import a multiple .trc files to a trace table

I have a set of rollover .trc files recorded with Sql Profiler. mytrace.trc mytrace_1.trc mytrace_2.trc mytrace_3.trc I can import the first one using this command: use [my-database] SELECT * INTO trace_folder FROM::fn_trace_gettable('C:\mytrace.trc', 4) However, this only appears to load the first file, not all four. ...

convert to UDF from select statement

How would one go about converting this into a scalar UDF? I'll pass the product_id to the UDF. Running SQL 2k5 SELECT sum(qty) as qty, product_id FROM vProductQuantity WHERE product_id = @product_id GROUP BY product_id ...

Why are there performance differences when a SQL function is called from .Net app vs when the same call is made in Management Studio

We are having a problem in our test and dev environments with a function that runs quite slowly at times when called from an .Net Application. When we call this function directly from management studio it works fine. Here are the differences when they are profiled: From the Application: CPU: 906 Reads: 61853 Writes: 0 Duration: 926 ...

sp_procedure_params_managed - how to eliminate these calls from EnterpriseLibrary?

We noticed in a SQL Server Profiler trace that this proc is being called: sp_procedure_params_managed Each call has 350+ reads in the trace! We are using Microsoft.Practices.EnterpriseLibrary.Data in an ASP.NET front end. How can we eliminate these stored procedure calls? We are not explicitly calling it in code. I'm running Sql Ser...

SQL Server Express performance issue

Hi folks ! I know my questions will sound silly and probably nobody will have perfect answer but since I am in a complete dead-end with the situation it will make me feel better to post it here. So... I have a SQL Server Express database that's 500 Mb. It contains 5 tables and maybe 30 stored procedure. This database is use to store a...

how to split a string in TSQL

I have a varchar @a='a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p' , wich have | delimitted values. I want to split this variable in a array or a table. Do anyone have any idea about this. ...

How to insert time in SQl Server 2005?

i am creating windows application .In this i have to subtract two dates .i subtract it successfully ,i used TimeSpan to get subtracted value.But when i insert it in SQl Server 2005 db, it inserted with starting date i.e. 1/1/1900 and the calculated difference which format should i use to insert Time only? Thanks in advance ...

find the all the stored procedures and jobs in sql server 2000

Hi, In SQL SERVER 2005 This query works fine : Select * from sys.procedures where object_definition(object_id) like '%J%' SELECT * FROM MSDB.DBO.SYSJOBS WHERE NAME LIKE '%J%' but in sql server 2000 it is not working. Here i need to find the all the stored procedures and jobs which matches my string ? how to find in sql server 2000 ? ...

Making rows in to colums using sql query

I have a temp table in which have one coloum with four rows. Table ------ vaibhav IBM 12 'T' I need a temp table Col1 Col2 Col3 Col4 ------ ----- ----- ------ Vaibhav IBM 12 'T' Do anyone have any idea. ...

Multipart Identifier And Functions

Here is my Query... Here I'm using a function Fn_getStagesForProject()... For which I need to pass the SWProjectID from Projects Table... The function takes the ID as parameter and return all stages that corressponds to the project, on which I need to filer only the row that contains StageLevel as 0. Select A.SWProjectID, ...

how to view the job in text in sql server 2005

hi, Ex: for store procedure we use sp_helptext .is there any keyword for viewing jobs in text in sql server 2005 regards kumar ...

Script to drop an index if it exists that works in SQL Server 2005 AND SQL Server Compact 3.5

I have an application with a rather long chain of upgrade scripts. The application works in SQL Server 2005 - I'm trying to upgrade it so it will also work in SQL Compact 3.5 Part of the script involves dropping old indexes if they exist. I REALLY want to have one script that can handle both scenarios. I've been having a lot of success...

SQL Server: Is it possible to get procedure or table creation and last alter date?

SQL Server: is it possible to get procedure or table creation and last alter date? If it is then how do to it? SQL Server 2005 ...