sql-server-2005

UNDEFINED data type when reading SQL database from Lotus Notes using ODBC: nvarchar

Hi, This is the second time it happens to me and before modifying a 3rd party Database structure I wanted to know if anyone knew a better solution: I'm accessing a MS SQL Server 2008 from a Lotus Notes Agent (Notes 7) to retrieve some data. I use LSXODBC and my "Select" statement works perfect... Except that my agent cannot "understand...

SQL NOT IN Clause

I have a query which is not working as expected Q1: SELECT id, name FROM vw_x WHERE id NOT IN (select pid from table_x) GROUP BY id, name Having max(c_date) > GETDATE() Q2: SELECT id, name FROM vw_x GROUP BY id, name Having max(c_date) > GETDATE() Q1 is not returning anything even though i know those ids are not in table_x Q2 run...

Find out If index and table statistics are out of date

Hi, I Update indexes with full scan weekly. so when I run: SELECT name AS index_name, STATS_DATE(OBJECT_ID, index_id) AS StatsUpdated FROM sys.indexes Ref: link text I expect it to show me that all indexes were updated this weekend. But there are several records which look like: index_name StatsUpdated clust 2005-10-14 01:36:2...

What is a dynamic SQL query, and when would I want to use one?

What is a dynamic SQL query, and when would I want to use one? I'm using SQL Server 2005. ...

Stored Procedure in SQLServer user login.

I write the procedure for the login where user can give username or emailid to login and password also. my procedure is like this create procedure users_login (@username varchar(50),@password varchar(50), @emailid varchar(50),@ret int output) as begin select username,password,emailid from users where username=isnull(@username...

best way in producing a master script for SQL

hi, i want to extract specific database tables & stored procedures into one master script. Do you know any software that can help me do this faster? I've tried using the SQL Database publishing tool, but it's not that efficient since its gathering tables that I didn't select. ...

how can i write the procedure for search using logical operator?

hi, in my application i have to write the procedure for search. so that user can give any combinatin of words like 'ar rehman and slumdog or daneboel ' like this how can i write the procedure for thi. using logical operators. ...

SQL query for dynamic insert row

I am having data like: ItemCode Attribute PositionID ITEM-000032 CHESTSIZE 1 ITEM-000032 JACKETLEN 2 ITEM-000042 CHESTSIZE 1 ITEM-000042 JACKETLEN 2 **ITEM-000049 SLACKWAIST 1** ITEM-000071 CHESTSIZE 1 ITEM-000071 JACKETLEN 2 ITEM-000074 CHESTSIZE 1 ...

Asp.net MVC with SQL Server stored Procedure

I am an asp.net webforms developer and new to asp.net MVC.... Is it possible to use SQL Server 2005 stored procedures in asp.net MVC?? If so can any one help me.... ...

SQL Server 2005 transaction log is always too big

Hi, I've read other posts and have done hours of research but am still none the wiser. I have a database that is 65 gig in the data file, and currently 230 gig in the log file. I'm trying to redesign the database so it is more efficient but when making schema changes, the log file tries to grow too large and the windows whinges that it's...

Configure database mail settings

How can I configure database mail settings and send the mail from the database in Sharepoint created default database instance as i can not find where to configure the database mail settings from the management after login sa user. ...

How do I get a proper weighted average date in SQL

I use this query to get my average date: CONVERT(DATETIME, AVG(CONVERT(FLOAT, ChargeOffDate))) as [Average C/O Date] Which correctly give me the date '2003-08-12 14:17:22.103'. When I use this query to get the weighted average date CONVERT(DATETIME, SUM(CONVERT(FLOAT, ChargeOffDate) * FaceValue) / SUM(FaceValue)) I get a date like...

Rename database data file in SQL Server 2005

I need to rename a databases data file. Is this possible through SQL Server Management Studio? FYI, I do not have permissions to the underlying box. Edit: I also need to change the location of the file. ...

How to setup a linked server to Access 2000 database?

I am using SQL 2005 Server Express. How can I setup a linked server to an MS Access 2000 database? ...

What are examples of SQL Server Query features/clauses that should be avoided?

What are examples of SQL Server Query features/clauses that should be avoided? Recently I got to know that the NOT IN clause degrades performance badly. Do you have more examples? ...

Bind xml column and regular columns from sql server in nested controls

I have a stored procedure which returns a mixture of plain columns, and one 'column' of xml datatype. As in: Select Field1, Field2, ( SELECT Certification As '@certification', LCID As '@lcid' FROM dbo.MemberCertifications FOR XML PATH('certification'), TYPE, ROOT('certifications') ) ...

Priming or warming cache in SQL Server

When I am testing a query I will typically drop the following lines in front of whatever i am testing to make sure I'm starting from the same baseline every time i run a query. CHECKPOINT GO DBCC FREEPROCCACHE GO DBCC DROPCLEANBUFFERS GO EXEC sp_MyProc 12345 On the Stored proc i was running today i noticed that when I ran it with thes...

Designing Database for File Structure

We are using file system to store files within the application. Now we change this to use SQL2K5 for storing as BLOB instead as per requirement. Now, we need advice regarding the design for table. Obviously, it must have a folder, files within files, size, last date modified, etc., similar to file system. I start with: FileID, Pare...

connect sql server 2005/2008 over internet

How do I connect to SQL Server 2005/2008 using Management Studio or other desktop application over the internet? ...

Open SQL CE .sdf in SQL Server 2005 or 2008

Hi, is there a way to import SQL CE .sdf to SQL Server 2005 or 2008? thanks in advance ...