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 > june 2005 > threads for friday june 17

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

Calculating Pay Periods
Posted by ninel gorbunov via SQLMonster.com at 6/17/2005 9:16:29 PM
The pay period at my company is from sunday to saturday. How can I calculate these pay periods for the next 5 years. Example: StartPeriod EndPeriod 20050612 20050618 20050619 20050625 20050626 20050702 Thanks, Ninel -- Message posted via http://www.sqlmonster.com...more >>


FOR loops
Posted by Christopher Weaver at 6/17/2005 6:36:02 PM
I used to use the 'FOR' keyword with 'INTO' and 'DO' to take specific actions for each row returned by a SELECT statement. Now I can't find the docs on it and I can't remember it well enough to make it work. Can anyone clarify or point me towards some samples?...more >>

CASE within a CASE
Posted by Jerry Spivey at 6/17/2005 4:20:29 PM
Hi, Is it possible to place a CASE statement within a CASE statement? Thanks Jerry ...more >>

how to abend in the middle of my T-sql script
Posted by Kanan at 6/17/2005 4:19:02 PM
Hi, I would like to know how I can make my T-sql script abend in the middle of my code. Here is my script: set xact_abort on declare @sql varchar(200) declare @p1 varchar(10) declare @p2 varchar(10) set @sql = N'select * from metric_denom_8' print @sql exec sp_executesql N'select * fro...more >>

LEFT OUTER JOINS
Posted by Asim at 6/17/2005 2:51:21 PM
Can someone help on this. I am having a problem equating two tables in this situation. I am calculating visits by cost centers and hospital campus on the dates when they were opened but for reporting purposes, i need to display each date for the time period hence needed to fill one temporary ...more >>

reporting services emails
Posted by helpful sql at 6/17/2005 2:25:56 PM
Hi all, I have created a Reporting Services Report and now I am trying to schedule it to be emailed every week. I made sure the RSReportServer.config file has correct values in SMTPServer(this is set to IP Address of SMTP server) and From(This is set to the e-mail address we created to use...more >>

CONVERTING DATETIME WITH BCP
Posted by Dario at 6/17/2005 1:57:02 PM
I have used SQL Loader from Oracle to get data into tables, but i cant find how to convert datetimes. I have the following file that i cant change code description xxxx 06/02/05 this date is in latin format dd/mm/yy but bcp understand this like mm/dd/yy Can i use convert to proper...more >>

Getting derived field from insert
Posted by tshad at 6/17/2005 1:42:09 PM
I have a stored procedure that inserts a record and creates a unique number from the last maximum unique number + 1. I need to pass that number back to the calling routine (or have the calling routine do a select on the maximum unique directly after). At the moment, I am doing an insert fo...more >>



Bulk Insert
Posted by swap NO[at]SPAM NO[at]SPAM NO[at]SPAM at 6/17/2005 1:35:01 PM
Hi, I have a file Script.sql. The Scrpit file has a Bulk insert statement like - @qry = 'bulk insert #tempTable from '''+@path+N''' with (DATAFILETYPE=''char'',ROWTERMINATOR=''\r'',CODEPAGE=''RAW'')' exec(@qry) Here @path is the path of another file Script1.sql. The file Script1.s...more >>

Tunning Help
Posted by Arul at 6/17/2005 1:17:08 PM
The <> in the where clause is causing this query to be extremely slow. Any way I can re-write this query? select * from FROM dbo.ORDER_DETAIL A INNER JOIN dbo.PRODUCT B ON A.PRODUCT_CODE = B.PRODUCT_CODE INNER JOIN dbo.PRODUCT C ON A.PARENT_PRODUCT = C.PARENT_PRODUCT WHERE B.P...more >>

date function for returning day name?
Posted by Logger at 6/17/2005 1:10:36 PM
Can anyone tell me if there are a date function that will tell me what day a date fall on like the month function. SELECT DATENAME(month, '03/12/2005') AS 'Month Name' Go This will tell me the month is March… I need to know that March 12,05 falls on a Saturday. ...more >>

tunning help
Posted by Arul at 6/17/2005 1:10:12 PM
This query runs for ever bcos of the <> in the where clause. Any way I can get around it? select * FROM dbo.ORDER_DETAIL A INNER JOIN dbo.PRODUCT B ON A.PRODUCT_CODE = B.PRODUCT_CODE INNER JOIN dbo.PRODUCT C ON A.PARENT_PRODUCT = C.PARENT_PRODUCT WHERE B.PRODUCT_CODE <> B.PAREN...more >>

Openquery
Posted by Ed at 6/17/2005 1:10:08 PM
hi, I read the BOL and it said we may use Openquery to do the Insert, Update, and Delete. Does anyone know how? I tired Select * from openquery(LinkedServerName, 'Insert into customer values ("111")') and of course, it doesn't work please help Ed ...more >>

system sp to disable replication on db
Posted by John Grandy at 6/17/2005 11:40:49 AM
I see how to remove replication objects and configurations from a replication distributor, disregarding any existing dependencies, by running the following SQL at the distributor server: sp_dropdistributor @no_checks=1 This suffices for my present servers configuration. However, I would...more >>

Rewrite SELECT with subquery as SELECT with join
Posted by Terri at 6/17/2005 11:28:49 AM
Is it always possible to rewrite a SELECT statement with a NOT IN subquery as a SELECT statement with a join? The following statement works but I want to return a field in the subquery in my main SELECT. There are no nulls in any of the fields. As I did not provide DDL and sample data an untested...more >>

Disable trigger question
Posted by Kenneth at 6/17/2005 10:54:39 AM
ALTER TABLE tblTable DISABLE TRIGGER ALL If I put this lines in a proc, will it be for my proc or for the whole database (every user) ALTER TABLE tblTable ENABLE TRIGGER ALL Regards Kenneth ...more >>

2 or more visits with in a week for the year
Posted by Yosi at 6/17/2005 10:47:06 AM
I need to create a query that iwll find all patrons who have seen a play in a weeks time. However the patron can have more than 1 ticket to a show. Here is the query that I have now: SELECT rpsClientName,rpsEvent,rpsSeriesDescr,rpsEventDate FROM reportstatic WHERE ...more >>

DELETE Query
Posted by CK at 6/17/2005 10:46:43 AM
Hey folks. I have a delete query that, when run from QA takes less than 1 second everytime. However, this delete is part of a stored procedure that contains a lot of other deletes. The procedure takes over a minute to run (causing the UI to timeout waiting for a reply). The execution plan ind...more >>

Alter numerous Columns
Posted by Lontae Jones at 6/17/2005 10:44:09 AM
Can you alter numerous columns? Alter table Test Alter column Col1 int Alter table Test Alter column Col2 int Can i put these together?...more >>

Index Suggesting Product
Posted by BDB at 6/17/2005 10:44:06 AM
Hi, Is anyone aware of a third party product that can suggest indexes based on a query that works off current table statistics, etc... much like the way the query execution plan estimator works? It seem to me that the query plan estimator could/should have the functionality to suggest inde...more >>

Distributed transaction does not roll back...
Posted by SammyBar at 6/17/2005 10:41:52 AM
Hi all, Distributed transaction does not rolls back. I have two sqlserver 2000 sp3 standard edition. In server A I defined a basic stored procedure 'KKTest'. It inserts a record into table zPais. The server B is linked to the server A and enabled to run distributed transactions. When I make th...more >>

self outter join help
Posted by Kurt Schroeder at 6/17/2005 10:40:16 AM
I'm trying to create an left outer join of a table on itself to fond missing records. I can get it to work if i create temp tables and then join those but not when i use the table itself WORKS: select h.stkhstcsisym into #t1 from stkhst h where h.stkhstdate = 20050601 order by h.stkh...more >>

Funky sql syntax to concatenate values - is this acceptable usage?
Posted by Sylvia at 6/17/2005 10:31:33 AM
Hello, A while back I found this way of concatenating from a select statement into one variable. It's very handy in a lot of situations: declare @test varchar(8000) select @test = '' select @test = @test + ', ' + name from sysobjects where type = 'u' order by name select @Test In the ...more >>

Where find SQLCODE's described?
Posted by Rick Charnes at 6/17/2005 10:16:18 AM
An old, reliable COBOL application of ours that connects to our SQL 2000 database suddenly returned this error: SQLCODE:-0000019703 Timeout expired ....and we're not sure why or what it means. Where can I look to find the various SQLCODE values described? I don't see anything in SQL S...more >>

Identity
Posted by XXX at 6/17/2005 9:02:19 AM
How can I find what tables have a column with IDENTITY property? Thanks. ...more >>

display float value
Posted by Shailesh Patel at 6/17/2005 8:45:17 AM
Hi, I want to display float number as 2.3 - 3.5 returned by sql statement. e.g select cast(h.low +' '+h.high as varchar) from .... does not return as expected above. Is there any other way to retrieve in this format. Thank you. Shailesh ...more >>

arabic data gets corrupted in stored procedure
Posted by Arvind Kumar at 6/17/2005 6:34:07 AM
CREATE PROCEDURE arg_financial_ratio_compare @compID1 int,@compID2 int,@compID3 int,@compID4 int,@sector char(1),@from int as /* create table #temp(pricePerShare float) insert into #temp select pricePerShare from tblxmldata where companyId = @companyID */ create table #retTable...more >>

Creating Index on sql VIEW
Posted by Brian at 6/17/2005 4:48:02 AM
I'm attemping to Add an index to a SQL VIEW Using the foillowing SQL Script. Create UNIQUE CLUSTERED INDEX CNSRECID On vw_Lead_Generated_By_Detail(RecID) But get the following messages, 'CONTSUPP' is the only table in the VIEW Server: Msg 1935, Level 16, State 1, Line 1 Cannot create i...more >>

Session_OnEnd Problem
Posted by Renjith at 6/17/2005 3:00:04 AM
hi Can any one give tell when Session_OnEnd event works , cause even when Session.Abandon or TimeOut , the event is not worlking renjith...more >>

Passing variables to UPDATE Command
Posted by krishnamurthy.mamidanna NO[at]SPAM valuelabs-dot-net.no-spam.invalid at 6/17/2005 1:00:25 AM
Hello everybody I have a problem in passing a variable into the Update command. Thi is my stored procedure CREATE PROCEDURE UpdateTable @tsID INT, @UpdateDesc varchar(1000 A DECLARE @TableNumber IN DECLARE @TableName NVARCHAR(100 DECLARE @SQL VARCHAR(100 /* I have to get the name of the ...more >>

remove time value in datetime / small datetime data type
Posted by Tom at 6/17/2005 12:00:00 AM
Hi : How to remove time value in datetime field or smalldatetime field for example invoicemaster.invdate = 2005-5-13 09:03:12 update invoicemaster set invdate = dateonly(invdate ) it will return : invoicemaster.invdate = 2005-5-13 How can do it? Thx ...more >>

SQL Server After Dial-In BUG ??
Posted by Aruna Tennakoon at 6/17/2005 12:00:00 AM
Hi Guys, I have a small problem, It's like this, I have a PC which has no LAN connection (MSDE Running), I am connecting to that PC tru a Dial-Up line from another PC, when I run the Query Analyzer for that PC IP, it doesn't get connect, but when I go there and restart the SQL Serve...more >>

WIERD permissions problem?
Posted by Paul W at 6/17/2005 12:00:00 AM
I have a table, tblRes, to which Public is denied all access, and no other groups have any access granted. If, from a user xuser, I try "select * from tblRes" I get, as expected "SELECT permission denied on object 'TblRes', database 'DB_117033', owner 'dbo'." I have created a stored proc...more >>


DevelopmentNow Blog