sql-server

SSIS - Performing a Lookup on another Table to get Related Column

I want to executing a select statement in SSIS, but this select statement takes a parameter from another component, and the column of this select statement must be used as inputs to other components. For example: select id from myTable where name = (column from a previous component). And the "id" content of the above select statement...

Identity Column Out of Sync

I have a table with an Identity column as Primary Key. All is well until one several days ago, application that is using this table start complaining about PK violation. At first I thought this was impossible, until I remember about DBCC CHECKIDENT. The magic function told me that the 'current column value' is higher than 'current ident...

How to properly support English and French dates with VB6 and SQL Server?

We are adding French support to an older VB6 app. The original developer used a mix of date formats when writing to the database, but SQL didn't seem to mind as it was all in English. (March 31, 2009 or 2009-03-31 etc...) When you try running the app on a French machine, you get: [-2147217913][Microsoft][ODBC SQL Server Driver][SQL Se...

Limitations of using binary_checksum() to represent a URL or similar string?

I have a log that is really huge. (millions of rows) LogTable ------- ID DATE BASEURL QUERYSTRING USER REFERRER USERAGENT SERVER I want to slim this table down by normalizing the data. (slim the size) I know! I know! A log should be a super-fast insert. On the other hand, the log table is so huge, the maintenance plan i...

SQL server: Compare rows

Hi SQL gurus, I need a query which can do the following operation. I have a table with 2 columns ID Values 1 1 1 2 1 3 1 4 2 2 2 5 2 6 if you see for ID 1 I have 1,2,3 and 4 as values and for ID 2 I have 2, 5 and 6. I want to write a query which return the following 1(-) 4(-) 5(+) 6(+) mean 1 and 4 are deleted and 5...

"Dcom Server Process Launcher" starts IIS Admin with VS 2008 installed, XP SP2

Wondering why "DCOM Server Process Luancher" starts up IIS Admin even when it's set to manual. Is this a factor of my Visual Studio 2008, SQL Server 2005, or something more nefarious involved? ...

Hello need help with on how to do this in SQL Server News from Forum Topics/Messages

Okay I have three tables that all communicate with each other. ForumTopic t ForumMessage m ForumUser u What I am trying to do is get the first message of each Topic. I have tried this SELECT m.[Message], m.[TopicID], m.[Posted], u.Name, t.[Views], t.NumPosts, t.Topic FROM [ForumMessage] m INNER JOIN ( SELECT TopicID,...

nhibernate query performance

I decided to test nhibernate on an existing application (replacing linq to sql) and I'm seeing abysmal results so far. Hopefully someone here can point me in the right direction. My config: <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="dialect">NHibernate.Dialect.MsSql2...

Database Table lock

I'm using SQL 2000 for my application. My application is using N tables. My application has a wrapper for SQL server called Database server. It is running as a 24/7 windows service. If I have checked the integrity check option in the SQL maintenance plan, when this task is running one time after that one of my tables has been locked and...

Is there any perfomance issue with Inner Join?

Hi, Currenlty I am using lot of inner join's(around 7) in my sp, does it have any impact on sp perfomance. does left outer join gives better perfomance then inner join. one more thing if i m joining two tables a and b which has column id and id1, both r not nullable. i suppose here i can go for inner join as these columns r indexed. ...

Session timeout error for ASP.net applications expires in 5 sec on one server & runs fine on another

Session timeout error for ASP.net applications expires in 5 sec whenever we login to website the session expires in 30 secs max & we are unable to save our work / submit our request from application. http://www.townplanning.in/ This is 3 year old website running on same server & now problem have started coming from past few days ........

SSMS - Edit data from result grid

I would like to edit data directly from result grid in ssms. eg: When I execute SELECT TOP 10 * FROM some_table, I want to edit data directly from result grid. I don't want to open some_table and edit from there. I know that result grid is read-only, but maybe someone written addin for it. ...

Counting lines of code of Stored Procedures in SQL Server 2005

Using SQL Server 2005 management studio, I have exported each Sprocs and Functions as a separate .sql file. Is there a way that using CLOC tool, I can produce lines of code metric? The CLOC site states that it supports SQL but it does not generate any metric in this case. Thanks, Ajit. ...

Invalid length parameter passed to SUBSTRING function

Hey all, Having a bit of a run in with SQL and Transactions... hoping some of you can shine a light on the problem. (and maybe even fix my screwed html! Does this site support formatting for different languages? Perl, SQL, Java?) This server runs on SQL Server 2005 and was very recently upgraded from SQL Server 2000. I'll keep an eye on...

How do I speed up deletes from a large database table?

Here's the problem I am trying to solve: I have recently completed a data layer re-design that allows me to load-balance my database across multiple shards. In order to keep shards balanced, I need to be able to migrate data from one shard to another, which involves copying from shard A to shard B, and then deleting the records from sha...

SP: Get 5 random records plus 1

Hi, I need to get 5 random records from a table plus a further record based on data from the users preferences as stored in a second table. Here are the two statements i have created so far: Gets favourite charity based on key set in TBL_MEMBERS: SELECT DISTINCT TBL_CHARITIES.* FROM TBL_CHARITIES JOIN TBL_MEMBERS ON TBL_CHARITIES.cha...

Real-Time monitoring of Network State. What events are raised?

I have a winform app that needs to be aware of when a SQL server is available so as to allow the Merge Syncing functionality. I have tried variations of the below, which work on a one time basis, but I would like to come up with something a little more dynamic. The below funcion(Thank you Alex_L) is checking for the 1433 port that SQ...

A better way of passing parameters to a TADOStoredProc (Delphi)

Hi, I am needing to convert a large amount of SQL queries into stored procedures. I have some code that updates about 20 or 30 values at one time in one Delphi procedure. I can handle creating a stored procedures to do such a thing. The problem is my way to pass parameters to stored procedures is very bulky like this: with stored_pr...

Cannot call scalar-valued CLR UDF from select ... from table statement

I have created a scalar-valued CLR UDF (user defined function). It takes a timezone id and a datetime and returns the datetime converted to that timezone. I can call it from a simple select without problems: "select dbo.udfConvert('Romance Standard Time', @datetime)" (@datetime is of course a valid datetime variable) But if I call it p...

SQL Latest Date

I have an interesting bit of logic that I can't seem to get my head around. We have a Purchase table, where each Purchase is linked to a Customer and a Date. We want to pull out the Purchase that each customer made closest to the end of each month. For instance, CustomerID | Date 1 | 01/20/2009 2 | 01/26/200...