sql-server

SQL Server Connection Problems

I have one server out of three which cannot connect to our sql server 2000 using the FQDN but can connect using the non FQDN. None of the the other servers are having this problem. This problem occurs under ADO connections to a SQL Server 2000 database. The database has encryption turned on. I don't want to turn it off. Does anyon...

SQL Server: datediff function resulted in an overflow

What does this error mean and how can I avoid it? The datediff function resulted in an overflow. The number of dateparts separating two date/time instances is too large. Try to use datediff with a less precise datepart. I am not using the datediff function. I am doing this query where Timestamp is a datetime type: SELECT TOP 10 *...

Want 'Exists' in a Where clause to be used only when passed parameter has a value

I have a Select like the one below in a stored procedure (shortened for brevity). @param is a parameter to the stored procedure which can be NULL. SELECT name FROM Table1 WHERE EXISTS (select .... from table2 Where param = @param AND ... AND ...) AND ... AND ... I would like the EXISTS statement (the part in bold) to be used only whe...

Retrieve data from remote server in SQL Server!

Is there any other way to retrieve data from a remote server in SQL Server 2005 instead of using linked server? ...

SQL SERVER 2008 - Memory Leak while storing Millions of records

I need some help very badly. I'm working on a project where a bulk of data is entered all the time. It's a reporting software. 10 Million records in an average is stored per day and it could keep on increasing as users increase. As of now, SQL SERVER CONSUMES 5gb of RAM on the task manager. I have an 8GB ram on my server now. How do o...

Error: String or binary data would be truncated.

Im getting this when running a query like this WITHOUT inserting in any table. in SSMS 2008. select iav.* from ITEM_ATTRIBUTE_VALUE iav where iav.attribute_value != '' and ISNUMERIC(iav.attribute_value) = 0 Why would it do this ? ...

How can I analyze and optimize my sql query

SELECT K.euclidNo,K.KlinikAdi,k.kisaAdi, (SELECT COUNT(1) FROM Seanslar AS S INNER JOIN Faturalar AS F ON F.fatura_id = S.refFatura_id INNER JOIN BasilmisFaturalar AS BF ON BF.basilmisFatura_id = F.refBasilmisFatura_id WHERE MONTH(S.tarihi)<MONTH(F.faturaTarihi) AND S.refKlinik_id = K.klinik_id AND S.durumuVT = 1 AND F.faturaTArihi BETW...

Finding Max and Min Times

I want to display max time and min time for a day in grid control using Visual Basic from a SQL Server database. My data currently looks like this: UserID UserName Date Time ------------------------------------------ 1 Shanks 30/1/2009 10:11:22 1 Shanks 30/1/2009 10:15:22 1 Shanks ...

Can find where my sql2K database files are stored

Hi, I am on a new computer, but I have access to my old computers hard drives. I can't find where the databases for my sql server 2k are stored. I have sql2005 express on the same computer. The folders I have: /program files/microsoft sql server/ /program files/microsoft sql server/80 /program files/microsoft sql server/90 /program ...

SQL, OPENXML and DateTime conversations...

Hi, I've inherited a mass of stored procedures that take as their only parameter a block of XML, the author then cracks it (using OPENXML) and then updates the a row. I've come across a problem while updating a table that has datetime columns, the following is a snippet of data that currently fails: declare @stuff nvarchar (max); set...

SQL Server Job exit with error when running in scheduled job but runs fine when running job manually

I have a job on SQL Server 2005 running a ssis package. The package as the protection level 'EncryptSensitiveWithPassword' the job has only one step of type Operating sytem(CmdExec), since the ssis uses an excel output file and the server is 64bits I do pass the password in the command run as a server proxy The job runs fine when I...

Why do you create a View in a database?

When and Why does some one decide that they need to create a View in their database? Why not just run a normal stored procedure or select? ...

SQL Server : find last time user was connected

I have a SQL Server (2000) with a number of accounts which I think are no longer used. Is there any way I can find out when each account was last used? Alternatively what is the easiest way to create a table of accounts logging on to the server over a period. ...

How can I extract string ‘abc.com’ from a string http://[email protected] using sql?

How can I extract string ‘abc.com’ from a string http://[email protected] using sql? ...

Sql server 2008 backup - backup tail of the log

Setting up maintenance plan for sql server 2008 backup Don't understand what exactly backup tail of the log, i read some ms articles about this. Still dumb enough for database to figure out what need to do. For regular backup strategy do i need to select backup tail of the log option? What would i loose or get with this option? If i s...

SQL 2000 Scheduled Jobs Max Character

I'm trying to schedule a long T-SQL script. However, the script gets cut off when pasted into the text box. I googled the problem and there is a 3200 character limit. What do you recommend I do to solve this? Create a stored procedure and run that as a scheduled job? Is there a better option? If it helps, here is the script. I...

SQL Server FOR XML adding in a tag

Heya, So I am pulling data from a SQL Server 2000 DB then converting it to XML using FOR XML AUTO. The XML I get back looks like this. <Order OrderNumber="2000004" DeliveryPickupCharge="5.9900" SalesTaxTotal="0.0000" SubTotal="0.0000" Total="5.9900"> <Customer FirstName="Anthony" LastName="Caporale"> <Product ProductName="Pap...

SQL: Combine Select count(*) from multiple tables

How do you combine multiple select count(*) from different table into one return? I have a similar sitiuation as this post but I want one return. I tried Union all but it spit back 3 separate rows of count. How do you combine them into one? select count(*) from foo1 where ID = '00123244552000258' union all select count(*) from foo2 ...

Implementing a massive search application

We have an email service that hosts close to 10000 domains such that we store the headers of messages in a SQL Server database. I need to implement an application that will search the message body for keywords. The messages are stored as files on a NAS storage system. As a proof of concept, I had implemented a SQL server based searc...

SQL Server speed

I had previously posted a question about my query speed with an XML column. After some further investigation I have found that it is not with the XML as previously thought. The table schema and query are very simple. There are over 800K rows, everything was running smooth but not with the increase in records it is taking almost a minute ...