Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008
all groups > sql server programming > january 2006 > threads for monday january 23

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

visual basic transformation script
Posted by atx at 1/23/2006 11:52:40 PM
Hi, someone send me a visual basic transformation script to tarnsform some data in sql 2000 server, but I don't know how to run that script. It would be very kind of you, if you can tell me step by step how to run (with which tool of sql server) that script. regards atx ...more >>


Restore MDF file
Posted by Sajith at 1/23/2006 11:19:02 PM
Hi all, I need a urgent help. My server crashed yesterday because of the harddisk problem. I lost my backup file and only got this *.mdf and *.ldf file. I tried to restore these using attach database method and also by creating a database...stop the sql service... overwrite the created da...more >>

query with a column per row of a linked table
Posted by WCL at 1/23/2006 9:45:40 PM
Is it possible to have query result to have a column per row of a table? e.g. Employees table ID (identity) FirstName Ref containing ID, FirstName 1 Tom 2 Dick 3 Harry Project table ID (identity) Name containing ID, Name 1 Client A ...more >>

generate update statements for existing data
Posted by Mike at 1/23/2006 8:25:02 PM
Does anyone know how to write scripts for generating update statements for existing data? I found a stored procedure online that generates INSERT statements for a given table, I was wondering if anyone has worked on a UPDATE generator...more >>

OBJECTPROPERTY question
Posted by Igor Solodovnikov at 1/23/2006 7:23:29 PM
Please look at following code: use mybase select name,OBJECTPROPERTY(id, N'IsExtendedProc') op from master.dbo.sysobjects where name=N'xp_myxp' use master select name,OBJECTPROPERTY(id, N'IsExtendedProc') op from master.dbo.sysobjects where name=N'xp_myxp' When OBJECTPROPERTY is calle...more >>

Group by datetime
Posted by sexball at 1/23/2006 7:17:50 PM
Hi, How can i group the datetime field with different time period in same day e.g 2006/1/23 07:00:00 12 2006/1/23 07:01:00 10 result : 2006/1/23 22 Thanks & Best Regards, Sexball ...more >>

Import MDF SQL 2000 file into SQL 2005 Express
Posted by Fabio Cavassini at 1/23/2006 6:08:30 PM
Is it possible? I only have the MDF from my SQL 2000 DB, and I need to import it to SQL Server 2005.... Best Regards Fabio Cavassini ...more >>

Changing between Identity type and Int type
Posted by krygim at 1/23/2006 6:04:37 PM
What is the TSQL command to chanage a column of int type to identity type and vice versa? Thanks in advance! KM ...more >>



Divide Integers
Posted by Paul Ilacqua at 1/23/2006 5:57:43 PM
I'm trying to divide 2 integers to return a column of C's per thousand with (Failures / Dropped) * 1000. I've tried different version of float, cast as decimal etc. I'd like 4-5 didgits after the decimal. What is the correct way to divide integers to return a usable number. Yr M...more >>

Optimizing insert performance
Posted by Mike Chamberlain at 1/23/2006 5:42:03 PM
Hi there. We're using SQL Server 2000 on a Windows 2000 box with dual hyperthreaded Intel CPUs, raided hard disks and 2GB RAM. It should certainly be able to handle our currently fairly modest demands. We have all the latest security patches. Parallelism is disabled. We're currently e...more >>

Datetime comparsion
Posted by sexball at 1/23/2006 5:36:01 PM
Hi, i need to create a sql statement to find out record between a period, but i only want to search with the date part only (e.g. 2006/1/23). In my database, the type of the field is in datetime format. How can i bypass the time part but still can find out what i need (e.g. 2006/1/23 00:00...more >>

slow accross subnets
Posted by gv at 1/23/2006 4:47:12 PM
Hi all, Running SQL Server 2000 on Windows Server 2003 Executing SP in VB client program accross subnets takes about 1:20 seconds. Within the same subnet takes only 7 seconds. Any ideas? thanks gv ...more >>

Update Query Help!
Posted by Arul at 1/23/2006 4:21:02 PM
I have a column name of Text datatype. Most of the values in this column contain html tags. For Example: Column Value = <P><FONT face=Verdana size=1>Regulatory Affairs.</FONT></P> Can someone please help me with an update statement that will replace "Verdana size=1" to "Arial size=1" fro...more >>

Design Question
Posted by Steve Beach at 1/23/2006 4:06:09 PM
I'm trying to normalize a table but I'm not sure what the proper way to do it is: Imagine you have these two tables: Commodities =========== CommodityID (primary key) Description UnitWeight UnitValue UnitOfMeasure CountryOfManufacture HTSCode ExportLicenseRequiredFg PackageConten...more >>

comparing dates
Posted by Trond Hoiberg at 1/23/2006 4:02:50 PM
I try to compare dates in a NON EXISTS expression like this: SELECT ArticleNo, SerialNumber, DateShipped, DateAssembled, DatePackedForShipment FROM ArticleSerialNumbersTempEgersund a WHERE (NOT EXISTS (SELECT b.ArticleNo, b.SerialNumber, b.Date...more >>

Conditional Join
Posted by Terri at 1/23/2006 3:50:19 PM
I want to join 2 tables conditionally. One order needs to join with one instruction. The three potential join fields are: Country, Exchange, and Type. These fields are required in the Orders table but only Country is required in Instructions. The data entry requirements of the application are su...more >>

I want to set this error into a variable
Posted by Ê÷Éϲä»Ò at 1/23/2006 3:45:26 PM
hi all Now I have an error operation, then SQL Server give error message as follows: Violation of UNIQUE KEY constraint 'gwbh'. Cannot insert duplicate key in object 't_xt_gwsj'. " I want to set this error into a variable, e.g. @errstr how to do? thanks! -- Ê÷Éϲä»Ò ...more >>

Why the correct index is not selected
Posted by George at 1/23/2006 3:21:03 PM
I have created the indexed view v_Tour_I_Idx with multiple indexes as UNIQUE CLUSTERED INDEX [TranTour_TranId_Idx] ON Column [TransactionId] ; INDEX [TranTour_Date_time_Idx] on column [Date_Time]; Both 2 columns have statistics and updated up-to-date. I have created another view as: ...more >>

Error 3716 - security settings
Posted by Random at 1/23/2006 3:16:47 PM
My first time encountering this error, and I can't find any documentation on it... adErrUnsafeOperation 3716 - "Safety settings on this computer prohibit accessing a data source on another domain." I'm calling a stored procedure in an enterprise environment, returning a single recordset,...more >>

SQL Express and DTS
Posted by shank at 1/23/2006 3:12:12 PM
Is anyone familiar with SQL Express? I installed it but cannot find any Data Tranformation Services. Has this feature been removed from this edition? I went to the SQL compariosn page but could not find DTS on any of the editions. thanks! ...more >>

Intra Query Error
Posted by Ricky at 1/23/2006 3:04:59 PM
Hi I seem to be getting the following error, when running a SP which = populates a table: *********************************** Server: Msg 8650, Level 13, State 127, Line 1 Intra-query parallelism caused your server command (process ID #62) to = deadlock. Rerun the query without intra-query...more >>

Question on Settings in Connection
Posted by Miguel Castanuela at 1/23/2006 2:49:20 PM
I've programmed a user defined function (SQL2000), which in a specific query references a linked server (another SQL instance, BTW contained in same physical server). The sintaxis is ok, but i couldn't apply the definition because of following error: "Error 7405: Heteogeneous queries requir...more >>

Subreports to separate books in excel
Posted by RC at 1/23/2006 1:35:57 PM
I have two subreports in a main report. I have the main in a subscription that gets push down to a pdf every morning. What the user has requested is to down load to an excel but each subreport to be in a separate book within the same excel file. Is this possible?? ...more >>

Substitute the Null fields in the results of a sql statement
Posted by Matt Sonic at 1/23/2006 1:33:02 PM
I have been at this all day. I have a view in SQL server that queries across two tables with a one to one relationship. I show all the fields in table one and get blanks where there is no record in table two. Is there a way to substitute the <Null>s with a string like 'BLANK'. They are cau...more >>

Multiple Contain Statements
Posted by CSHARPITPRO at 1/23/2006 1:04:02 PM
I need some help with this syntax Select * FROM PROJECTS WHERE CONTAINS(Problem_Description, '"Invalid use of null"') And WHERE CONTAINS(Problem_Status, '"Open"') Can you have multiple CONTAINS Statements? I am getting a syntax error with the above code snippet. What am I missing? Thank...more >>

Tracking updated columns
Posted by attila.safari NO[at]SPAM gmail.com at 1/23/2006 1:01:07 PM
Is there a simple way in an update trigger to identify what columns have changed? We have a web-based application that requires us to show a log of column changes associated with a record. For example if a user logs in through the website, changes their name on a web-form, we update the databa...more >>

Domain name from URL
Posted by Chris Pratt at 1/23/2006 12:13:49 PM
Does anyone know how to extract just the domain from a URL in T-SQL? So, for example, http://www.awebsite.com/pages/thispage.html" would come out as http://www.awebsite.com, or just www.awebsite.com. Many thanks for any help. ...more >>

Coalesce Question
Posted by RitaG at 1/23/2006 12:12:04 PM
Hi. I'm using Coalesce to change a NULL returned value from a Select statement. Here's my code: SELECT TOP 1 @StartDate = Coalesce(Discount_Effect_Date, '01/01/1980') FROM MyTable WHERE RTrim(Subtable_Id) = 'I03U' Print @StartDate When I have a row in MyTable where the Subtable_Id = '...more >>

Transaction log file size?
Posted by Linn Kubler at 1/23/2006 11:56:22 AM
Hi, I'm just wondering, how big should the transaction log files be in relation to the database files? I noticed the the transaction log files on my server are quite a bit larger than the database files. Is this normal? Thanks in advance, Linn ...more >>

A trigger that backups data from several tables...??
Posted by patte at 1/23/2006 11:31:17 AM
Hi, I have a problem... I want to backup data to a backuptable from a table that has a relation to an another table. And the backup should be done with a trigger when an update or delete occurs... What I mean is that if I have a table A with columns of NameID, Name and LinkID... then the Link...more >>

Linking Excel and SQL
Posted by Preacher Man at 1/23/2006 10:25:23 AM
I would like to link an Excel Spreadsheet to my SQL 2K Database. Where do I need to start? For example. I would like to have a cell in Excel that gives me the sum of Sales Orders in my SQL Database. I would also like for this to be able to change according to a date field in excel that c...more >>

How to specify another Server
Posted by Imtiaz at 1/23/2006 10:01:03 AM
In select Query SQL Query Analyzer how to specify a different server name. For Ex: If i want to copy data using "insert into select......" statement from a different server to my current server, Is it possible using SQL Server 2000? Thanks Imtiaz ...more >>

Fast updates in SQL Server
Posted by Nesaar at 1/23/2006 9:54:15 AM
Hi In Oracle there is a concept that allows one to perform an update without using the rollback logs so you can try to improve the performance of an update. Does such functionality exist in SQL Server 2000? I cannot seem to find anything on it in BOL Thanks N ...more >>

Data lost during converting int to smallint
Posted by culam at 1/23/2006 9:53:03 AM
I am trying to keep it consistent with data from the source, I change datatype for a field from int to smallint and it has a value between 200 and 1000. When I do it in Enterprise Manager, I give me this warning: - Warning: Data might be lost converting column 'auto_pre_appr' from 'int'. Is...more >>

Calculating Quarters for a Forcasting Report
Posted by Claude at 1/23/2006 9:34:07 AM
I am writting a query for a forcasting report and I am having a problem figuring out how to calculate the amount of quarters that a certain contract spans. I need to calculate the total quarters and then divide the total contract by that quarter total to get the a single quarter value. Then calc...more >>

Datetime convert problem
Posted by Mubashir Khan at 1/23/2006 9:31:16 AM
i am using select CONVERT(varchar(15),getdate(),101) result is 1/23/2006 but i want result in 01/23/2005 what am i doing wrong. Any db settings??? ...more >>

Creating a Stored Procedure to collect DB information and then run another Stored Procedure using that information
Posted by MKruer NO[at]SPAM gmail.com at 1/23/2006 8:29:05 AM
First off I would like to admit that I am an beginner to intermediate SQL user, so I am familiar with the logic flow, simple commands, and terminology, however I am not experienced and still learning. I have been given a project to create a stored procedure that will execute a repair, reindex ...more >>

Date range with only an 'EffectiveFrom' column
Posted by Leon Mayne at 1/23/2006 8:20:07 AM
Hi all, OK, bear with me on this! I have a load of tables that are related, and one of the tables holds 'points' associated with skills which are associated with products. As an example I've rewritten this to be programs as the products, and therefore skills associated with the products are e...more >>

Database backup?
Posted by Linn Kubler at 1/23/2006 8:13:48 AM
Hi, Two questions, in the query analyzer I typed this: backup database hcn to disk 'D:\Microsoft SQL Server\MSSQL\BACKUP\mybackup01232006.bak' And I got a syntax error: Line 1: Incorrect syntax near 'D:\Microsoft SQL Server\MSSQL\BACKUP\hcnprod01232006.bak'. I also tried it without the...more >>

Using aliases with COMPUTE
Posted by Catalin NASTAC at 1/23/2006 8:11:03 AM
Hello, What exactly means the "control-breaks in the result set"? From an ADO recordset, I will see the summary as a new recordset? If I will use MyRst.NextRecordset I will move to summary recordset? If this is the case, is it any way to use alias in this summary recordset instead of "cnt" or...more >>

Query/table tweaking Help
Posted by CD at 1/23/2006 8:02:44 AM
I am not a programmer but have noticed in this query peaking my processor when running. The table has over 2.7 million rows. Is there a better way to write the sp for better performance or tweak the table? The excution plan shows TableScan 37%>Filter 56%> Sort 4%>pParallelism/Gather Stream ...more >>

Passing Parameters
Posted by Keith Brown at 1/23/2006 7:35:32 AM
Can you pass a part of a table name as a parameter? Our database was created so that the last four characters of the table name are client specific so each time we get client data, the last four characters are different, causing me to modify all queries I have setup. For example a table na...more >>

Cursors within stored procedures
Posted by peteandrews NO[at]SPAM hotmail.com at 1/23/2006 7:25:17 AM
Hi, I've got a stored procedure that makes use of several cursors to collate data and then place it into a temp table, which is then eventually returned to the calling code. The problem is that when I execute the stored proc, opening the cursors seems to be returning a recordset, when all I n...more >>

BCP path problem
Posted by Karin at 1/23/2006 7:20:06 AM
Why can't I include the path to the bcp utility when I use xp_cmdshell? This works fine in the command window: "C:\Program Files\Microsoft SQL Server\80\Tools\binn\bcp" "ABData.dbo.tCMD_OutputToFile" out "c:\temp\abdata.txt" -c -U"chagus" -P"c" but this don't work from within SQL Query Ana...more >>

using datetime in where clause
Posted by Lothar Krenzien at 1/23/2006 6:50:04 AM
Hi there, I have a mysterious problem when I use a datetime value in a where clause. On a SQL Server installation on Windows 2000 it works as expected but on Windows 2003 I don't get a value. Here's an example : select * from dbo.tblImportEffBlockData where efficiencyBlockId = 305 an...more >>

Job Status Suspended
Posted by markfcook NO[at]SPAM gmail.com at 1/23/2006 6:42:33 AM
i am trying to code a proc that tests whether a job is running. i understand how to get job status from the xp_sqlagent_enum_jobs via the current execution status and i also understand that status = 4 means the job is idle. what does status =5 (suspended) mean? The BOL information seems to in...more >>

Setting database options in a view
Posted by hals_left at 1/23/2006 6:07:10 AM
Is it possible to use : set concat_null_yields_null off Inside a view ? Thanks ...more >>

Foreign key to multiple tables
Posted by Geoff Lane at 1/23/2006 5:00:42 AM
SQL Server 2000 accessed via ADO. I have a "lending libray" type of application with key tables represented by the following DDL: CREATE TABLE LibraryItem ( ItemID INT PRIMARY KEY IDENTITY, ItemName VARCHAR(128), LoanTypeID INT, BorrowerID INT, LoanDate DATETIME...more >>

DTS completion time jump
Posted by Patrice at 1/23/2006 5:00:02 AM
Hi, I have a DTS package that runs 4 other packages on a nightly basis. This package usually takes about 2 hours to run, but ocasionally it jumps to around 5 hours to complete. There have not been any changes to the parameters or coding. It is the same process that causes this each time ...more >>

query - which came last?
Posted by Tales Mein at 1/23/2006 2:50:28 AM
Hi, Query puzzler here. I have a table of PEOPLE. Besides the Person ID, each record has five Date fields- Married , Graduated, Started Job, Got Famous, Got Rich I want to write a query that shows what the current status of each person is. In other words, show which event has happen...more >>

SQL SERVER PARSE ERRORS
Posted by Satish at 1/23/2006 12:42:02 AM
I have a requirement to know all the parse errors happening in my sql server 2005. Is there any log file /error file which stores this information. Is there any other way by which I can store all the parse errors happening in my sql server ?. If microsoft sql server does not store Pars...more >>

Use ACCESS driver on Win NT4.0
Posted by Use ACCESS driver on Win NT4.0 at 1/23/2006 12:13:03 AM
My application needs to run its database on MS ACCESS. But Win NT4.0 does not support the latest MS ACCESS database -- its driver is out of date. Can I run the redist.exe deployed with SQL2000 to update latest driver? Is it free?...more >>

Bulk Insert Problem
Posted by Ghulam Farid at 1/23/2006 12:12:02 AM
Hi to All! I am trying to use the 'Bulk Insert' command to load a data file into a MS-SQL db. The line I am using is: BULK INSERT Data..tbl_load FROM 'C:\Data\data.txt' WITH ( DATAFILETYPE = 'char', FIELDTERMINATOR = '\t', ROWTERMINATOR = '\n' ) Sql Server is giving error: ...more >>


DevelopmentNow Blog