sql-server

Tool to copy SQL Server 2008 db to SQL Server 2008 Express?

I have a typical dev scenario: I have a SQL 2008 database that I want to copy every so often to my local instance of 2008 Express so that I can do dev, make changes, etc. to the local copy. I have some constraints though: the source db is part of a live e-commerce site in shared hosting so I can't detach it and the hosting service wants ...

Realtime Web Search (in .Net)

Hi, How would you guys go about creating a "real-time" search engine on .Net platform. Near real-time search of the web is so popular nowadays and I was hoping you guys would help me brainstorm some ideas. I might try to make some prototype eventually, but mostly it is just a "mental training". The requirements are: .NET platform, I...

Converting String to bit before inserting into the database

Can anyone help in converting string value in C# to bit equivalent in Sql. I'm trying to bulkcopy the values of a datatable into Sql table. All the values I've in the datatable are in string format. When I try to bulkcopy to SQL table I'm getting an error for bit datatype columns.Can anyone please post the C# code to convert string to...

sql query two field from one table join one field from a table

I have two tables: users(userid, username) and cases(cid,assign_to,received_by) I want to join assign_to and received_by with user_id and produce username. How do I join these table and how I produce username to assign_to and received_by? These two fields assign_to and received_by are stored different userid. > eg assign_to ...

Programmatically generate script for all objects in a database

For an automated setup build that generates the setup for an application which uses Microsoft SQL Server, I am currently evaluating whether the following is possible: I want to programmatically (CMD script or C# code) execute the function "Generate Scripts" on a database that is accessible from Microsoft SQL Server Management Studio 200...

SQL Server Function.

What is wrong with this function... The function intends to remove the specified leading characters from a given string. I know there is a patindex base solution to this which however doesn't consider spaces and all zero entries... but I want to know what is wrong with this one... If I input "00012345" it should out put me "12345" howev...

LINQ: DataContext Life and System.Data.SqlClient.SqlException: Timeout expired.

Hi there, i seem to be getting a lot of this in my Linq 2 SQL System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. There is really no reason for it, its a simple query that returns 1 record. I was thinking about opening my datacontext w...

Best practice: Searching table against day, month or year..

I've got a table with a "date" column, where a user input will be queried against (using stored procedure)..and results will be shown on a datagrid.. now a user can either enter a year, Year/month , Year/month/day.. (from drop down lists) i know there r many possible ways to handle the different queries.. however i am trying to figure ...

Reportins services Timeout expired

Hi, I'm developing a Report Service and while excecuting the query getting : An error has occurred during report processing. Exception has been thrown by the target of an invocation. Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. I know that on the SQL server th...

ms sql2000 arabic problem

I hava a table in ms sql2000 with a column defined as nvarchar when query this table in java i get data for this column like this : يا هلا بالشباب الحلوين يا شباب ا٠شلونكو؟. When i try php with adodb i get the data as it should be ,in arabic. but i need to use java not php ,please can any one help m...

Varbinary(max) images Visual Studio 2008

Hi, I need to read records from a employee database and display selected items (not in Gridview) - this is fine except for the image that is stored in varbinary(max). I need to step through the records - forwards and backwards. There are some records that has not image. I am having problems understanding the convertion method using that ...

Trying to add a where clause for row_number

I am trying to add a where clause to the following query: SELECT TOP 200 ROW_NUMBER() OVER (ORDER BY KEY_TBL.RANK DESC) AS RowNumber, FT_TBL.JobId, FT_TBL.Title, FT_TBL.[Description], FT_TBL.Location, KEY_TBL.RANK FROM Jobs AS FT_TBL INNER JOIN FREETEXTTABLE (Jobs, (Title, [Description]), 'packaging') AS KEY_TBL ON FT_TBL.JobId = KEY...

Weighted average in T-SQL (like Excel's SUMPRODUCT)

I am looking for a way to derive a weighted average from two rows of data with the same number of columns, where the average is as follows (borrowing Excel notation): (A1*B1)+(A2*B2)+...+(An*Bn)/SUM(A1:An) The first part reflects the same functionality as Excel's SUMPRODUCT() function. My catch is that I need to dynamically specify...

Looking for comprehensive tutorials for using SQL Server datasets and .NET Windows Forms.

Title should explain what I'm looking for. I need to learn everything from the ground up. I've spent a day or two learning how to make windows forms applications, the basic functionality, but now I need to connect to a database and do some more advanced stuff and I am so lost. So something that goes slow and doesn't omit the basics be...

Rewriting correlated subquery as JOIN?

UPDATE: Thanks to Sifu Bill's advice I have amended the SQL query. Now it returns the correct number of distinct assets (five). Is it possible to rewrite the following correlated subquery as a JOIN? SELECT TOP 100 PERCENT Asset_ID, work_order_id, status_id, downtime_hours, date_completed FROM dbo.mtvw_wo_reason1 WHERE (Asset_ID IN (SEL...

Automatically Creates tables from another database's table

when i create a new database it automatically creates tables which is already at another database and i need no table when i create a new database so to stop this i need your help.. ...

Getting the production database to work with locally

I'm nearing the stage of saying "lets go live" of a client's system I've been working on for the past few months, basically a few autonomous services including a public facing website, an intranet website, an hourly exporter from a legacy OLTP DB based on modified flags/triggers etc.. and few others services that compose the system, with...

SQL Publish to Provider (Wizard) Scripting Stored Procedures Only

I'm using the Publish to Provider option in my SQL Project in Visual Studio 2008. I only check the box to script stored procedures leaving all others unchecked, yet the script produced includes all objects. Why is this and how do I stop it? Cheers, Breandán ...

SQL Server login problem for a windows service on reboot

Hi, I have a service that has a dependency on SQL server express (2005). Every morning when I reboot my machine, I see that the service has not started. In the event viewer, I see the following error: Service cannot be started. System.Data.SqlClient.SqlException: Cannot open database "MyDatabase" requested by the login. The login faile...

after submiting form data it show's the following problem

An Exception has occurred! com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 1. ...