sql-server

SQL Query Costing, aggregating a view is faster?

I have a table, Sheet1$ that contains 616 records. I have another table, Rates$ that contains 47880 records. Rates contains a response rate for a given record in the sheet for 90 days from a mailing date. Within all 90 days of a records Rates relation the total response is ALWAYS 1 (100%) Example: Sheet1$: Record 1, 1000 QTY, 5% R...

How do I debug slow NHibernate Select query?

I'm doing a simple query on the database, a search on two columns. I have an index on the columns. When I do the search in SQL Server Management Studio, it takes only a few milliseconds to complete (always less than 10). When I do the same query in NHibernate, it takes over 30 seconds. I've profiled the query, and the generated SQL is fi...

how to insert a specific data in text file(with .log extension) into database table?

I have managed to insert the whole text-file data in SQL-SERVER database table with this statement BULK INSERT [dbo].[tablename] FROM 'c:\weblog.log' WITH ( FIELDTERMINATOR = ' ', ROWTERMINATOR = '\n' ) But my text-file is not organized in any format and it contains some data i want to omit from the insertion process. So i am looking ...

How to find first and last date of week specific to month?

Dear Team, How to find first and last date of week specific to a month on passing of getdate()? For Example: Case 1 Today is '16 July 2010' I want Week_Start_Date as '11 July 2010' and Week_End_Date as '17 July 2010' Case 2 Today is '2 July 2010' I want Week_Start_Date as '1 July 2010' and Week_End_Date as '3 July 2010' Any help ...

SQL ENCODING IN SQL Management studio

Hi all We have tri-lingual system at work, english,greek and russian. I have an issue with russian when i update some of the fields in my database. If i use an update query to update a field form the default english to russian i get '?????????' instead of the russian characters.if i update directly by hand it shown correctly. Help! ...

SQL Server 2008 - Query execute => timeout on my webservice - web application

When i execute a query on my SQL Server (same database as my web application) and my query gets a timeout, all my web users on my web application also receive a timeout. Is it possible to avoid this problem? ...

Distributor- meaning of- configured on separate database server instances?

Distributor The Distributor is a database instance that acts as a store for replication specific data associated with one or more Publishers. Each Publisher is associated with a single database (known as a distribution database) at the Distributor. The distribution database stores replication status data, metadata about the publication, ...

get the hours for every month

Hi Guys, I have created a function which will take two parameters as startdate, enddate and returns hours from that. here i am getting both the total hours but i need to get individual month hours from that. Regards, kumar ...

SQL Server, Unused tables for a long time (How to get rid of unnecesarry tables)?

Is there a way to find the unused tables which are nothing else but rubbish in database ? ...

SQL Server - Select integer that falls between brackets ( )

HI, how can i select the Integer that falls between a pair of ( ) begining from the right of a cell? Reason being, there might be another pair of brackets containing characters and what if some records are w/o close brackets for some reason.. e.g. Period | ProgrammeName | Jan | ABC (Children) (30) | Feb | H...

using doctrine 2 with SQL Server

I need to migrate an existing project, built on the current beta of doctrine 2, from mysql to SQL Server. I have complete control of the SQL Server. In the DBAL Folder of Doctrine there already is a PDOMsSql driver, but I can't figure out, how to use it. (there is still no documentation) Doctrine also offers two other ways, I could ma...

Creating a SQL Server user with permission to read one view and nothing else - but he can see system views and procedures?

My company hired a contractor to do a small project for us, for which he needs to select data from one single view in our main database (SQL Server 2005). I wanted to create a locked-down SQL Server login for him, with permissions just to SELECT from "his" view...and nothing else. So I created a new user on the server, and then I gav...

sql server query

HI, i have a table with 5 columns keyword D1 D2 D3 Total how 1 1 1 3 are 0 0 2 2 you 0 1 0 1 i want to retrieve only columns count where the name starts with D so form the above table the result should be 3 please help. ...

Multiple Alias names for a table

Can we have multiple alias names for a single table? ...

Deploy Sql Server in .NET using my application

I have winforms application in my company to deploy applications in several environments (Development, PreProduction, Production). Now, I want to include a new functionality: I need to deploy SQL Server scripts in environments: development, preproduction and production. My application will run directly in these environments. I do not ...

Can i monitor performance of particular table in sql server 2008 profiler

I want to monitor all the DML commands that run on a particular table of my database in sql server profiler. Im using sql server 2008 R2 ...

how to split and insert CSV data into a new table in single statement?

I have a table named "Documents" containing a column as below: DocumentID I have data in the format - @DocID = 1,2,3,4 How do I insert these documentID's in separate rows using a single query? ...

SQL Server 2005 and SQL Server 2008 Coexisting in Windows 7 machine

Some SQL Server 2005 and 2008 questions. 1) Can they coexist on the same Windows 7 machine without issues? 2) Can you attach and run 2005 databases to SQL Server 2008 without compatibility issues or is this a no go? 3) Does SQL Server 2005 even work on Windows 7? ...

Are there existing data layers I can use for an application I'm building?

I'm writing a .NET application and the thought of implementing a data layer from scratch is icky to me. (By data layer I'm referring to the code that talks to the database, not the layer which abstracts the database access into domain objects [sometimes called the data access layer and used interchangeably with data layer].) I'd like ...

SQL: Normalizing Code / Export - Import

I've decided to rewrite a database I have that is poorly normalized. I've created the new database but now need to move data from the old database into the new one. I'm not sure exactly how to accomplish though. For example, in the old database I have a webDorms table that looks like this: id (PK, int) room_type (varchar) description (...