sql-server-2005

SQL Server Equivalent to ORACLE INSTR

Hi All, I wanted to know if in SQL Server there is an equivalent to the Oracle INSTR function? I know that there is CHARINDEX and PATINDEX, but with the oracle version I can also specify the Nth appearance of the character(s) I am looking for. Oracle INSTR: instr( string1, string2 [, start_position [, nth_appearance ] ] ) The CHARINDE...

SQL Server Profiling how should I go about it?

Hi all, So I have used SQL Profiler before and I know how I can view what my LINQ queries are doing behind the scenes. Now, we are in the process of identifying queries that may take more time and need to be optimized or have some indexing. So, now when I view my LINQ queries in the profiler running it side by side there is lot of oth...

Debugging stored procedures in Visual Studio 2008 Pro

I'm trying to setup debugging of stored procedures in VS 2008 Pro, when I right-click on the connection in the Server Explorer I don't see the Allow SQL CLR Debugging option at all. The SQL Server is remote and running the 2005 express edition, so I'm not sure if I have to enable something on the remote server itself. Any help is appre...

SQL Server 2005 backup and restore

Hi folks, I have two backup files 1) is named 'backup.sql' with a bunch of SQL defining TABLES 2) is named 'backup' with a bunch of encoded data, which I believe are the ROWS I need to restore these TABLES + ROWS, but all I am able to figure out is how to restore the tables. Any tips on dealing with these files? It's the first tim...

SQL Server 2005 Performance

We have SQL Server 2005 SP3 Enterprise 32-bit running on a Windows server 2003 Enterprise 32-bit with 32GB of RAM and 8 dual core processors. Our CPU, RAM, and I/O are always through the roof and the application is always running slow. We use AWE for buffer cache the maximum memory is 28GB, the PAGEIOLATCH_SH is always high and the proce...

Character set in SQL Server 2005

I've run this code in MySQL, and it's succeeded. But when I run it in SQL Server 2005, this error occurred: Incorrect syntax near the keyword 'DEFAULT' This is the code: CREATE DATABASE mydb DEFAULT CHARACTER SET utf8 Anyone can explain why it couldn't run successfully in SQL Server 2005. Thanks and sorry for my bad English! ...

Sql server recursive query

This is just like a referral program. A guy can refer 3 guys under him i.e, 3 is referring three guys namely 4 5 8 similarly 4 is referring 9 10 and 11 likewise 8 is referring 12, 13 it goes like this.. I want a query to get all EmpId under Supervisor 3 ...

Can any one tell me how to find the records not in second table ?

hi everyone how to find the records which are present in the second from the first table in sql server 2005. ...

how to import database created in microsoft sql server 2005 to MySql server 5.0

I have created database in microsoft sql server 2005 can i use that particular database in mysql server 5.0 . ...

GUI tools for mysql 5.0

Is their any GUI-interface for MySQL, like Microsoft SQL Server 2005 Server Management Studio provides? Because basically I am operating MySQL with command prompt interface. ...

Need high-performance query

Possible Duplicates: Concat groups in SQL Server How to use GROUP BY to concatenate strings in SQL Server? I need a very high-performance query: This is the original table that I am querying: userID group 1 A 1 B 1 D 2 E 2 G 3 Null The result I need is li...

How can i aggrategate/pivot this data?

I have a set of records that keeps track of system availability. Sample data: System_ID Event DateOfEvent 1 Down 2010-05-01 13:20:10 1 Up 2010-05-01 13:25:19 1 Down 2010-05-05 10:12:12 1 Up 2010-05-06 14:10:16 2 Down 2010-05-05 20:22:22 2 Up 2...

Max within a timeframe with date duplicates

I have a table like this DateTime start_time not null, DateTime end_time not null, Status_Id int not null, Entry_Id int not null I want to get the count of each status within a time period, where only the last started is valid for a given entry_id. What I am using now is this (with dynamic dates): with c (Status_Id, Entry_Id, Start_...

Sql server 2005 - Cascade delete in all related tables

CREATE Table A ( AId int , AName varchar(100) ) CREATE Table B ( BId int, AId int, CId int, BName varchar(100) ) CREATE Table C ( CId int, CName varchar (100) ) "A" has foreign key in "B" and "C" also has foreign key in B. Both foreign keys have Cascade delete enabled. Foreign key :- /****** Object: ForeignKey [FK_B_A] ...

How to 'select' the current identity value for a table?

dbcc checkident (MyTable, NORESEED) Will show the identity value in a message. I can't see the message as I need to select the identity value through a DataReader. Anyone any ideas? Thanks folks ...

Conversion of decimal and date/datetime types into custom varchar equivalents

I am generating a flat text file via an SSIS package. The package reads data from a table, creates a fixed length text file and ftp's the file to a partner. The data arrives into my table via a process that I have control over so I can make adjustments based on suggestions. My quandry is this. I have a two fields, lets call them: Dat...

generate scripts automatically

Hi Guys, I need to generate automatic sql script of SP, views, triggers etc. Is there any tool available that i can use where i just need to put in the name for example SP name and it generates a create script for that for me. sql server 2005 Thanks ...

A simple VB.net SQL data query that is not returning any records

I am trying to debug my code, which involves a simple webservice that passes parameters to a data class, which calls a stored proc, and returns one row of record. I am not getting any error messages, but I am not getting any records back either. My webservice code is: <WebMethod()> _ Public Function GetDataValues(ByVal AutoVIN As Str...

I need to show the monthly inventory data

I have a table some thing like as follows for Inventory details. InventoryTable. InventoryTableID DateCreated quantity ItemName ------------------------------------------------- 1 2010-02-04 12 abc 2 2010-03-10 4 abc 3 2010-03-13 5 xyz 4 201...

Unable to connect to SQL Server 2005

I am trying to connect to SQL Server 2005 express edition from SQL Server Management. From the server configuration manager, I found the SQL Server Service to be running and within bracket, it's written(SQLEXPRESS). I understand SQLEXPRESS is the instance name, therefore I have to use following string for server name: \SQLEXPRESS. I am...