sql-server

What bcp format file that I'm gonna used to insert 59 columns?

First Observation, limitation with this BCP format file Data File: (Continuous up to three lines) 1;a;b;c;d;e;f;; 2;d;e;f;g;h;i;; 3;g;h;i;j;k;l;; 4;j;k;l;m;n;o;; 5;m;n;o;p;q;r;; 6;p;q;r;s;t;u;;What bcp format file that I'm gonna used to insert 59 columns? Format File: 9.0 9 1 SQLCHAR 0 0 "" 0 x "" 2 SQLCHAR 0 0 ";" 2 col1 Latin...

Call a sproc from another sproc on a different machine

I am using SQL server 2000. I have a stored procedure sitting on machine A. I want to call this stored procedure from within a stored procedure on machine B. How do I go about this? ...

How can I get TotalPages in SSRS Report body?

Hi Is there any way to get total pages in ssrs report body? I tried different metods but could not get page number in the report body ...

How to expand rows from count in tsql only

I have a table that contains a number and a range value. For instance, one column has the value of 40 and the other column has a value of 100 meaning that starting 40 the range has 100 values ending in 139 inclusive of the number 40. I want to write a tsql statement that expands my data into individual rows. I think I need a cte for th...

Sql 2005 data migration

I have the same database running on two different machines. The DB's make extensive use of Identity columns, and the tables have clashed pretty horribly. I now want to merge these two together before sorting out the undelying issue which I may do by A) Using GUIDs (unweildy but works everywhere) B) Assigning Identity ranges, kind of na...

How to programmatically find a many to many relation in an SQL Server 2005 database

I can find a direct table foreign key in c# like: foreach (ForeignKey key in CurrentTable.ForeignKeys) { Console.WriteLine("FK:" + key.ReferencedTable); } The classic representation for a many to many relationship is achieved via an intermediate table that has a one to many relation to the two principa...

Linked Server Error

I am using Linked server For transferring data using MSDTC Alter Proc [dbo].[usp_Select_TransferingDatasFromServerCheckingforExample] @RserverName varchar(100), ----- Server Name @RUserid Varchar(100), ----- server user id @RPass Varchar(100), ----- Server Password @DbName varchar(100) ----- Server d...

List table names

I'm in the process of trying to migrate my ASPNET site to Django. All my current data is tied up in MS SQL Server on a shared host that (helpfully) doesn't support python... I could use my existing code to export all the data but I've also stopped using Windows. The site is mainly compiled VB.NET so I'd need to install Windows and Visual...

in ssis how do I include a reference to a global variable from a script component?

I have a script component which I need to reference a global variable? I guess I can dtsconfig file. How do I set this and read it back out from my script component? ...

How do I preview a destructive SQL query?

When writing destructive queries (e.g., DELETE or UPDATE) in SQL Server Management Studio I always find myself wishing I could preview the results of the query without actually running it. Access very conveniently allows you to do this, but I prefer to code my SQL by hand which, sadly, Access is very poor at. So my question is twofold: ...

SQL server ADO.NET over low bandwidth TCP/IP connection any tips/experience ?

Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". En example for MySql...

SQL Server security via TSQL

I want to construct a transact sql script that will stop specified people from running certain commands against all databases: drop database, drop table or preferbly drop * delete update Is this possible? The user will already have access to the server. Note : I am not trying to develop a security model for a server, or to prevent...

SQL Server Replication connection error

After I renamed my PC, I couldn't create new paublications, for database replication in SQL Server 2005. I receive un error "SQL Server replication requires the actual server name to make connection to the server." When I returned my old PC name, the problem solved. How could I make use of replication after renaming the PC? ...

Get associated row from history table

If you have a table which holds history (updates, deletes) from another table, how would you pull an associated update row if it comes after a delete operation? Table has the following columns not related to the data ID int, -- Identity OP varchar -- the delete or update operation coded as 'D' or 'U' Removed_Date -- the date th...

Does deleting a row cause an update trigger to fire?

In SQL Server 2000, by default, does a DELETE query cause a table's UPDATE trigger to be executed? I know I can define a trigger that will be executed on both DELETE and UPDATE, but I thought I would verify that this is in fact required first. ...

Can you search SQL Server 2005 Stored Procedure content?

SQL Server Server 2005. I'm staring at a database that has 500+ stored procedures, and trying to glean the intricacies of how they interact with the data - particularly in regards to how they insert/modify data. I was hoping to find a search" or "find" functionality that would look at the content of the actual procedure. That way, I c...

best way to collapse a sparsely populated matrix

I have a sparsely populated matrix that's the result of a series of left joins. I'd like to collapse it down to a single row (see below). The only solution I've seen to this is a GROUP BY on the PK and a MAX() on ColA, ColB etc. Performance is a huge issue here, so I'd like to know if anyone has a better solution. The columns ColA, ColB ...

ms sql problem - cyrillic search

I modified one of the apps I made for russian market. Everything seemed to be fine, there was an issue when you enter data into database but it was solved by by setting page encoding to utf-8. So inserting and retrieving works fine. I ran into problem I just have no idea how to tackle. When I ran following query (simplified) in mssql que...

Convert string to uniqueidentifier in VBScript

...

Are temporary tables thread-safe?

I'm using SQL Server 2000, and many of the stored procedures it use temp tables extensively. The database has a lot of traffic, and I'm concerned about the thread-safety of creating and dropping temp tables. Lets say I have a stored procedure which creates a few temp tables, it may even join temp tables to other temp tables, etc. And le...