sql-server

SQL script to aggregate column values

hey all, i'd appreciate some help putting together a sql script to copy data from one table to another. essentially what i need to do for each row in the source table is aggregate the column values and store them into a single column in the target table. TableA: ID, ColumnA, ColumnB, ColumnC TableB: Identity, ColumnX so, ColumnX nee...

Can a Sql Server Full Text Catalog find the following?

Hi folks, i have the following data in a field, which is being indexed by a Full Text Catalog. Pamorama City, Los Angeles, California, United States Simple. (I also have lots of others, but they are working fine). Now, if the user provides this incorrect, mispelt search word pamorma city <-- notice the middle 'a' is missi...

Best approach to Insert a new record with 40 columns from a VB.Net app

A colleague of mine is working on a .NET application. He needs to write his save function for his object. Normally he would use a stored procedure in SQL Server to do this, but with 40 columns that is quite a task. Several of our other colleagues have preferred using XSD's for their database interaction. What is going to give the bes...

How to execute nested scripts in Sql Server 2005+

Do any sql ninja's know how to execute a script (.sql) from within another script? Specifically for the Sql Server 2005+ platform. E.g. psudeo code follows: ScriptA contents RESTORE DATABASE [MyDbName] FROM DISK = N'path' WITH FILE = 1 ....... GO Exec c:\scripts\ScriptB.sql ScriptB contents USE [MyDbName] GO IF NOT EXIST...

Are there any tools to do Migrations (a la Ruby) on Microsoft SQL Server (MSSQL)?

Are there any tools, or 'best practices' for creating Migrations on MSSQL? I have a Dev & Production database, and the Dev one often has new SPROCs created, and occasionally the structure is added to. I'd like to be able to write a set of scripts during each iteration which will update the Dev server, then execute all the scripts at rele...

SQL GOTO statement using variable label

i was hoping to be able to do something like this: declare @label varchar set @label = 'label_1' goto @label label_1: label_2: of course, sql server gives me an incorrect syntax error... so i was wondering if i can still do this with a slightly different syntax? ...

Storing and retrieving session variables in Reporting Services 2008

Is there a way to set session variables during login that are then available to reports? We have a reporting services server where we move and denormalize data from our transaction system for reporting purposes. In order to allow our users to login with the same user name and password from the transactional system we have set up custom ...

Organization Id Field as a Composite Primary Key

We currently have a system where each client gets their own database when they sign-up. Not surprisingly this is getting out of hand. We are preparing merge all these databases together to a single db. In order to do this we need to note which organization the row belongs. How best is this handled on the database and what pros/cons (...

Identifying underlying sql connection of SqlConnection object

I can use GetHashCode() to identify an object but is there any way to identify the actual sql connection obtained by a SqlConnection object? I'm (still) trying to debug a problem involving pooled connections and application roles and if I could reliably identify the underlying sql connection it could help a lot. Here's some code that m...

SQL IsNumeric Returns True but SQL Reports 'Conversion Failed'

Assuming the following data: Column1 (data type: varchar(50)) -------- 11.6 -1 1,000 10" Non-Numeric String I have a query,which is pulling data from this column and would like to determine if the value is a number, then return it as such in my query. So I am doing the following SELECT CASE WHEN IsNumeric(Replace(Column1,'"','')...

What is the best way to assign the returned value of a stored proc to a variable in SQL?

I have a stored procedure that returns a valueI call it from other stored procedures that need to retrieve this value. The calling stored procedure is inside a transaction, the stored procedure that returns the value (and actually creates the value and stores it in a table that no other proc touches) is not inside its own transaction, bu...

How Do I Copy and Overwrite a Database in SQL Server 2005 with SSIS?

I HAVE to be missing something really simple here! I have a database in my development environment called Project. I have a database in my test environment called Project_UAT. I've created an SSIS package that successfully copied my database from Project to Project_UAT. I'm pretty sure this eliminates most permission and configuration ...

Moving Data from SQL Server to Oracle Repeatedly

What are the most reasonable ways to move table data from SQL Server to Oracle (on *nix) on a regular basis? ...

How do I pull data from my old server to my SQL server?

I want to write a code that transfers data from on server to my SQL Server. Before I put the data in, I want to delete the current data. Then put the data from one to the other. How do I do that. This is snippets from the code I have so far. string SQL = ConfigurationManager.ConnectionStrings["SQLServer"].ToString(); string OLD = Co...

Make SQL Server faster at manipulating data - turn off transaction logging?

I use SQL Server 2005 as a data store for a lot of data I do analytic work on. This is not a transactional database as I am not hitting it with updates or capturing real time data. I get a few gigs of data from my clients, load them into SQL Server and do a series of manipulations. I then grab bits of this data and pull them into R where...

Cursor with Stored Procedure Question

Hi everyone, this is my first time using this site. OK, i need to use a cursor to call a stored procedure that has 2 parameters that i need to pass into from Customers table. Here is what i mean; My goal is to pass all the CustomerID and CustomerName from Customers table into my stored procedure called AddCustomers which has 2 paramet...

Alternatives to MS SQL 2005 FullText Catalog

I can't seem to get acceptable performance from FullText Catalogs. We have situations where we must run 100k+ queries as quickly as possible. Some of the queries use FREETEXT some don't. Here's an example of a query IF EXISTS(select 1 from user_data d where d.userid=@userid and FREETEXT(*, @activities) SET @match=1 This can take bet...

How to insert and read a pdf file to Sql Server 2005 database using C#

Hello, can anyone say how to insert the pdf file into sqlserver 2005 and read the pdf file from sqlserver... Thanks in advace ...

How to move data from VistaDB to MS SQL Server?

Currently, I have a blog that is using VistaDB as back-end database, but later I realize that I want to MS SQL Server instead. I was wondering there is any tools that are available for migration data like this problem? ...

Best load balance configuration with Windows 2008 and SQL Server 2008

I have two servers running Windows 2008 Web Edition and SQL 2008 Standard Edition, how would be the best approach to load balance them? Should I use database mirroring or log shipping? Is Win2008 NLB easy to configure by a developer, since I'm not a sys admin? What I'm looking for is to be able to have my sites running in case of a si...