sql-server

Trouble with contradicting where clause

Hi, I am trying to display what each user has spend their time doing for the week(either internal or external work) but the time is all on the same column on the table, is it possible to split it into 2 different columns and still have it so that it only shows each user once not each time they entered time which could be multiple times ...

SQL Query to Re-build Indexes

Hi Is there any SQL query equivalent to Re-building the indexes. In SQL Server Management Studio Select desired DB and select the table, click on the "+" symbol to expand the table properties, in that select indexes, if already indexes exists it will list. Right click the index you can see "Rebuild " option What i want is the this op...

Free FoxPro DB to SQL Server DB sync tool

Which software can you recommend to sync data from a FoxPro source to a SQL Server destination? ...

what are the LIve example for logshipping and replication ?

what are the LIve example for logshipping and replication ? ...

TSQL to tell which network protocol is being used for each active session

Once upon a time, I remember running some TSQL which would display which network protocol (e.g. named pipes, TCP/IP) was being used by each active session - but I can't remember the actual code. Does anyone know how to do this ? An input parameter might have been SPID. The code was useful for diagnostic purposes. ...

question on Group by clause in Sql server

Table: Customer Name Type Amount James P 125.00 James P 125.00 James P 125.00 James R 225.00 James R 225.00 Rajiv R 155.00 Rajiv R 155.00 Rajiv R 155.00 Rajiv P 150.00 Rajiv P 150.00 Saran R 175.00 In this table structure I want a output which will give each person’s count of P, count...

systable for sql server

Is there any system table to find the columns for DDLChangeLog_ID, InsertionDate,CurrentUser, LoginName, Username, EventType, objectName, objectType, tsql ...

cache repository's result or maybe sql server does it for me

I have repositories like this in my application public class FooRepo { public Foo Get(int id) { return Foo from Db; } } I'm just wondering if there is possible to do some caching for the methods inside the repository, or probably there is no need because sql-server does it for me, but if needed could someone point/s...

Select DISTINCT, return entire row

I have a table with 10 columns. I want to return all rows for which Col006 is distinct, but return all columns... How can I do this? if column 6 appears like this: | Column 6 | | item1 | | item1 | | item2 | | item1 | I want to return two rows, one of the records with item1 and the other with item2, along with all oth...

query to join two tables using a primary key and comma separate the results

Hi, Suppose there are two tables- T1 T2 --- ---------- A A | 1 A A | 2 A A | 3 How to write a query that returns the results as following Col1 Col2 ---- ----- A 1,2,3 (One row) Thanks in advance ...

SQL Server: rollback after insert that contains an output inserted fails mysteriously.

A rollback after an insert that contains an output statement fails with "The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION." If the output statement is removed, then it works. Is there an explanation for this behavior? Example: create table test(i integer primary key) go begin transaction insert into test (i) va...

SysIndex - difference b/w is_unique and is_unique_constraint

runing a select query on SQL Server 2008, sys.indexes gives me information on the index define for a database . There 2 fields is_unique and is_unique_constraint. I dont understand the difference b/w them . ...

Problem in creating User in SqlServer using smo

1) If there is already a login 'user1' then I create a user 'user1' for database 'db1' by calling CreateDatabaseUser function 2) Else, I create a login 'user1' with password 'password1' with default database as 'db1' (only after creating db1) using CreateServerLogin and then I create user 'user1' for 'db1' using CreateDatabaseUser ...

get ssis package output from SP

I have a SP that runs a SSIS package. xp_cmdshell 'dtexec /f "F:\SSIS Package\test.dtsx" /Rep E' When I run the SP in VS I get an Output window where I can see if it was successful. Is there a way to get the output from this into my asp.net application ? ...

Entity Framework deadlock problem

I'm having a strange problem with new Entity Framework for .NET 4 I have a SQL Server 2005 (EXPRESS) database and my service writes data to two tables using entity framework. Let's say tables are TableA and TableB. TableB has foreign key to TableA. In my program there are several threads that writes data in parallel. Each thread has its...

Date Format incorrect in Reporting Services

I have a Date Time field in a report with format set to 31/01/2000 13:30. It says on the dialog that Formats that begin with an asterisk () will reflect the regional settings of the report. It also confirms below that my current regional settings are: English (UK) I then deploy to my local report server and run the report and it displ...

create database programticaly

I m trying to create database programticaly using c#. i created scripts from datbase creation. which works when i run it from sqlserver mngmt studio. but when i ru same scripts from c3 application follwing error occurs. An unhandled exception of type 'Microsoft.SqlServer.Management.Common.ExecutionFailureException' occurred in Microso...

SQL Server View Primary Key

Is there a way to give a view a primary key in sql server. I know it is possible in oracle. I am not concerned about updates its a read only view but someone else is using it in ms access so I would like the constraint that I know to be correct to be shown. ...

should I use LIKE to query tables with 4 million rows

I am designing a search form, and I am wondering whether should I give the possibility to search by using LIKE %search_string% for a table that is going to have up to 4 million rows ...

VB.net program dataadapter connection closes after fill, but database still shows connection

After running the following sub (VS debugger), I try to detach the database in SSMS, but it shows the connection open still and won't let me detach. If I close program in debugger, the database shows no connections. I check the dataadapter's connection in the finally block and is shows closed. What gives Private Function ClientMasterDBF...