sql-server

Scripts or Utilties to capture a subset of data for development.

We're inherting a project at work from another office that has closed down. The production database is around 150GB and we're shying away from copying this to 4 dev machines to work from. Are there any scripts, utilities or suggestions on how we can go about capturing a small subset of this data, say 5%, to work with in development - whi...

How to import data from a view in another database (in another server) into a table in SQL Server 2000?

I was thinking about using bcp command to solve the user authentication, but does a bcp command capable to import to a table in my database? By the way, I am using SQL Server 2000 environment. Here's the code I have got so far: SET @Command = 'bcp "SELECT vwTest.* from [myserver\sql].test.dbo.vwTest" queryout dbo.Test -C ACP -c -r \...

How do I accurately insert a sql script into a SqlServer table.

I'd like to insert a sql script into a table. I'm pretty sure this is more complicated than just wrapping the script in quotes and throwing it in an insert statement (scripts with quotes and more complicated escaping seem problematic for example) So, how can I safely store arbitrary tsql in a SqlServer table? I can use either sql or c#...

webreference: how do I speed them up?

I am using some webrefernces for reporting services. The first time they load they are really really slow. Is there any way to reference the files locally? ...

Does the Developer edition of SQL Server let you have multiple users?

Does anyone know if the 2008 Developer edition of SQL Server allows you to have multiple developers access it on the same server? I called Microsoft, but the guy I talked to didn't seem to know the answer. Has anyone tried it? I am a developer that uses the Express edition now on one server and all four of our developers use it in our L...

Buying Microsoft SQL Server 2008 Web Edition

Hello, Probably this isn't the right place... but ill give it a try. I want to buy Microsoft SQL Server 2008 Web Edition in order to remotly install it on the server. The question is: Can i buy a licence in USA? and pay in dollars? or do i have to buy it in my country (Portugal)? However since the servers are in Germany, should i buy ...

What are these sys.sp_* Stored Procedures doing?

I'm tracking down an odd and massive performance problem in my SQL server installation. On my system, a particular stored procedure takes 2 minutes to execute; on a colleague's system it takes less than 1 second. We have similar databases/data and configurations, but there's obviously something very different. I ran the SP in question t...

SQL Server distance search

I have a Microsoft SQL Server database with a table of Locations. Each location has its address and latitude and longitude coordinates. In my application, the user can input a zipcode and we return a list of close by locations. This is my approach. a) Using a zipcode DB I search the lat,lon for the zipcode (this is the center point). b)...

How can I programmatically determine if a stored procedure selects from another database?

On an MS SQL Server 2000 installation I have numerous stored procedures that pull data from databases other than the one it's stored in. All selects occur on the same database server. For example: select * from [OtherDatabase]..table How can I find which procedures do that sort of thing without eyeballing each one? ...

How to go about creating a SQL Server Agent clone / customization (NOT another SQL Server Express Agent question)

I'm managing a web app featuring countless ETL (Extract, Transform & Load) processes feeding a datawarehouse (using SSIS dtsx packages + *.sql files). At the moment, everything is governed by several SQL Agent processes monitoring "scheduling queue" tables. I'm trying to figure out a way to develop a scheduler or scheduling "framework"...

A way to add a constraint between two domains in a table without using a trigger?

I have a following table, Client. create table Client ( ClientID int identity primary key, TaxID varchar(12), SSN varchar(12) ) GO Client can have either TaxID or SSN or both. But either one should exist. Currently, I am enforcing the rule thru following trigger. create trigger trgClient_UniqueTaxIDSSN ...

Looking for good method for versioning SQL Server databases

I have multilpe versions of my software that I need to run at any moment. We have a copy of each of our client's data in each version, which is a database. I am trying to find a good way to accomplish this in SQL Server. At first I was thinking of having everything in one once instance of SQL Server and tacking the version# on the end o...

SQL server conditional select statement

Ok, this might be an easy one, but I just can't get it. I am creating a page which will query a table with many columns and most items are not unique. I need to be able to get a list of records that match as many of the (up to 4) search criteria as possible. Example: I am user searching for the following items, I enter at least one an...

What causes a high Scan Count in SQL Server IO Statistics?

I understand that these are table or index scans that are being performed. I'm a little unclear on what would cause some tables to have a large scan count while others would have a small scan count. In a query I am looking at right now i am getting a scan count of about 150,000 on two tables in my query, while the rest have only a few....

Id of object before insertion into database (Linq to SQL)

Hi, From what I gather, Linq to SQL doesn't actually execute any database commands (including the opening of database connections) until the SubmitChanges() method is called. If this is the case, I would like to increase the efficiency of a few methods. Is it possible for me to retrieve the ID of an object before inserting it? I'd rath...

How do I execute sql text passed as an sp parameter?

I have a stored procedure with an nvarchar parameter. I expect callers to supply the text for a sql command when using this SP. How do I execute the supplied sql command from within the SP? Is this even possible?- I thought it was possible using EXEC but the following: EXEC @script errors indicating it can't find a stored procedur...

Calling SQL Server stored procedures via ODBC fails, leaving empty tables

We are using ODBC from C on Linux. We can successfully execute direct statements ("INSERT ...", "SELECT ...", etc) using ODBC for both SQL Server 2008 and MySQL. We are migrating to stored procedures, so we first developed MySQL stored procedures. Calling MySQL stored procedures using ODBC works. Life is good. The stored procedures are ...

Updating the table with conditon problem

Using SQL Server 2005, VB.Net In my application am using 3 textbox Textbox1.text = Date Textbox2.text = TimeIn Textbox3.text = TimeOut I want to update my table by using the textbox value with condtion For Example Textbox1.text = 23/02/2009 Textbox2.text = 10:00 - HH:mm Textbox3.text = 18:00 Query update table1 set TimeIn = '" ...

Which is quicker COALESCE OR ISNULL ?

I understand the difference between these functions but my question is when checking for a single null value would ISNULL be any quicker than using COALESCE? e.g COALESCE(SELECT TOP 1 SomeValue FROM SomeTable, 0) vs ISNULL(SELECT TOP 1 SomeValue FROM SomeTable, 0) ...

Java switch from MS SQL to MySQL - Character sets

Hi Folks, I am developing an application connecting to a database in Java. The customer has SQL Server and I tried the SQLExpress version von Microsoft as long as we don't want to buy a licence for the developement time. Sadly, the SQL Server Express does not allow network access so we can't work over network on the same database and ha...