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 > april 2006 > threads for thursday april 27

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

Grant execute on many procs in 2005
Posted by Andre at 4/27/2006 10:31:01 PM
I need to grant execute permissions to many stored procs to a user. How do you accomplish this in 2005?...more >>


Please help on this matching problem
Posted by auro88 at 4/27/2006 9:11:08 PM
I have these two tables: Leads =============== id date account id 1 1/1/2005 1-abc 2 7/1/2005 1-abc 3 8/1/2005 1-xyz 4 8/15/2005 1-xyz Sales ================= id date account id 1 8/1/2005 1-abc 2 9/1/2005 1-abc 3 9/1/2005 1-xyz Resul...more >>

Date and Time in SQLServer 2005
Posted by Helmut Woess at 4/27/2006 8:55:37 PM
Hello, i heard about Date and Time as new datatypes in SQL Server 2005. But they are still not implemented. Will they come with one of the next servicepacks or with SQL Server 20XX in some years (or never)? Can i do something with user defined datatype? Helmut...more >>

Logging Errors to a User-Table in Yukon
Posted by Alex Clark at 4/27/2006 5:44:59 PM
Hi All, Using SQL 2005, I want to trap errors in my stored procs using the BEGIN CATCH...etc construct. Easy enough, and I can get detailed information about the error using all the nice new functions like ERROR_PROCEDURE() etc. However, what I really want to do is pass that error informa...more >>

EXECUTE permissions
Posted by Andre at 4/27/2006 5:04:01 PM
I need to grant a user execute permissions on 1000 stored procedures. This there any easy way to do this in SQL 2005?...more >>

Problem with Grouping
Posted by yan at 4/27/2006 4:50:53 PM
Hi, I have 2 tables from which I need to get 2 figures: 1. Divide the Total of Table2 by the Total of Table1 and multiple by 10 as in the top select and this yields the correct results. 2. Display the Amount using the same formula as above per each Id and here is where I fail.....when I sum...more >>

SQL Server Express "Description" Property
Posted by Dan Manes at 4/27/2006 4:22:47 PM
If you use the GUI to modify a table in Management Studio Express, there's a column property called "Description." I'd like to be able to set and access that property using SQL. I played with sp_addextendedproperty and fn_listextendedproperty but this particular "Description" doesn't seem to...more >>

update statistics
Posted by simon at 4/27/2006 4:13:10 PM
I have indexed view but query is still slow. When I run the query, I get the following message in the execution plan of my view: Warning: statistics missing for this table. If I execute: UPDATE STATISTICS myView WITH FULLSCANnothing happens - still the same message.If I execute this st...more >>



Gaining complete exclusive access to a given table
Posted by Markus Zingg at 4/27/2006 3:47:12 PM
Hi Group While I'm fully aware that there are transations and that stuff like this should be left to the server administration tools etc. I'm still facing the problem of writing a middle ware where the existing, unchangeabel upper layer application want's to get exclusive access over a comple...more >>

Cursor, CTE and syntax issue. Thanks for your help!
Posted by Farmer at 4/27/2006 3:30:50 PM
Thank you for your help. I am trying to use CTE with a cursor to drive an encapsulated logic in the procedure. In BOL it states "A query referencing a CTE can be used to define a cursor." but I can't seem to figure out syntax and no examples are given Any tips what I am doing wrong? ...more >>

Shrink database?
Posted by Greg Strong at 4/27/2006 3:16:16 PM
Hello All, I'm using Access as a front end to MSDE 2000. What is the best way to shrink the database using code? Presently I'm using a stored procedure called from VB, however error 3251 is generated and the database is still shrunk. It works, but I thought maybe there may be a problem due ...more >>

Cancelling an insert with a trigger
Posted by Ferdinand Zaubzer at 4/27/2006 2:52:04 PM
How can I cancel an Insert in a Trigger? Thanks F...more >>

DISTINCT returns duplicates
Posted by alto at 4/27/2006 2:47:40 PM
I use the DISTINCT keyword to avoid returning duplicates from the query below (multivariable search for plants). However the result does contain duplicates and I just can't figure out why. Please help! TIA CREATE PROCEDURE dbo.usp_MultivarSearch_Plantes ( @Value varchar(256) , @Cate...more >>

Trouble With A Trigger
Posted by Chris Lieb at 4/27/2006 2:19:54 PM
I am writing a web app that sends the ID of the user along with other arguments to a stored proc that then either inserts or updates a record. This allows us to see who last changed the contents of any row. I figured that to record those moments when someone has to go edit the table by hand th...more >>

Accessing the FileSystem
Posted by Angel at 4/27/2006 1:58:02 PM
Is there a way to access the File System via T-SQL. There is a field in a table of mine. In this table there is a filename to a file on my server. I want to make sure that the filename actually points to a file on the server. In other words I want to make sure the file exists! Thanks in adv...more >>

Joining Rows in a SubQuery
Posted by Fabuloussites at 4/27/2006 1:37:02 PM
I have the following code in a stored procedure SELECT CatID, ParentId, CategoryName, (select count(*) from members WHERE DirectoryCat = DirectoryCats.CatID and InFreeDirectory=1 and ApproveDirectory=1) pagecount FROM DirectoryCats where active=1 order by CategoryName it's output is...more >>

IP address Long to octec format
Posted by GA at 4/27/2006 1:16:34 PM
Hello, can anybody outline a SQL function to convert an IP address formatted as long into dotted format? The equivalent in Perl is, @sip being the conversion function: #!/usr/bin/perl #gets the user entry for ip long value $long = <STDIN>; #when reading from stdin it is a nice i...more >>

indexed view and 'ANSI_NULLS
Posted by simon at 4/27/2006 1:14:02 PM
I executed the following statements: IF sessionproperty('ARITHABORT') = 0 SET ARITHABORT ON IF sessionproperty('CONCAT_NULL_YIELDS_NULL') = 0 SET CONCAT_NULL_YIELDS_NULL ON IF sessionproperty('QUOTED_IDENTIFIER') = 0 SET QUOTED_IDENTIFIER ON IF sessionproperty('ANSI_NULLS') = 0 SET ANSI_NULL...more >>

Recommended Reading to Learn 2005
Posted by Jeremy S. at 4/27/2006 12:55:34 PM
My situation is this: while I have been working extensively with SQL Server 2000 for 5+ years and am quite comfortable with it, I just took on a project that will require SQL Server 2005. The project starts in 3 weeks and I haven't really looked at 2005 yet. I would appreciate suggestions f...more >>

Delay in inserting records continuously into the Database
Posted by Peri at 4/27/2006 11:36:14 AM
Dear All, I am having a process which continuously inserts a record into a single table with the following table schema: CREATE TABLE [MessageLog] ( [MessageIndex] [int] IDENTITY (1, 1) NOT NULL , [SegmentCode] [smallint] NULL , [SetID] [smallint] NULL , [ScripCode] [int] NULL , [C...more >>

page splits/ fragmentation
Posted by Panos Stavroulis. at 4/27/2006 11:28:02 AM
Hi, I am inserting data into a table in what I believe is the correct way. The table is clustered on the date and I am inserting data that 90% of the time comes in the correct order, ie today I am inserting 2006/04/27 but 10% may be from 2005 or 2004. I think I need a clustered index on the...more >>

Structure Question
Posted by McHenry at 4/27/2006 11:05:26 AM
I have a table for suburbs with the following columns: Suburb State Postcode Only the combination of these three columns equates to a unique row. When joining to other tables I have added an ID column IDENTITY. The question is what should my primary key be ? Thanks in advance... ...more >>

Conditional Selection
Posted by Jeff Mason at 4/27/2006 11:04:43 AM
Hi, Hi, I'm trying to construct a query (in a stored procedure) which will have a number of selection criteria based on input parameters. There are a number of these parameters whose selection conditions they represent which all have to be true for a row to be returned in the resultset. ...more >>

Analyzer 2000 using 2005 database gives error
Posted by Richard Douglass at 4/27/2006 11:01:18 AM
I am using Query Analyzer 2000 and pointing at a 2005 database. I keep getting an error that I think it related to some code that is selecting data into a temp table. The procedure runs perfect on a 2000 database. here is the message [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionC...more >>

Local MDF Files--can I make this work?
Posted by Greg P at 4/27/2006 10:46:02 AM
Ok, so I'm upgrading a single user vb 6-Access app to a multi-user VS2005-Sql Server app. The client would like to move to SQL Server yet we are not ready to do so yet. The problem is that I can not install anything (sql Server or Sql Express) on these servers for now. Later on we will be a...more >>

Blocking
Posted by Rect at 4/27/2006 10:41:02 AM
Hi I have lot of blocking issues in my DB and complaining to my vendor did not yield any results.They point that DB is the bottleneck.I have a application running 4 cpu box with 4 GB RAM.I get blocking every hour. I am thiniking of writing a script which would run continuosly and kill the ...more >>

View Performance?
Posted by Phill at 4/27/2006 10:36:02 AM
Is there any performance loss or gain when using a view versus accessing the table directly?...more >>

Convert digits to letters
Posted by Radhames at 4/27/2006 10:29:02 AM
I want to know if somebody have a fucntion to convert numbers to letters. for Example: 56 to Fifty Six or 10,599 to Ten Thousand five hundred and ninety nine. Please help me.... Radhames...more >>

how to use TABLESAMPLE in select statement...
Posted by === Steve L === at 4/27/2006 10:19:57 AM
was told it's available in sql2005, but didn't work when i tried it. such as USE AdventureWorks GO SELECT AVG(OrderQty) FROM Sales.SalesOrderDetail TABLESAMPLE SYSTEM (40 PERCENT) error message says incorrect syntax near key word 'percent'. ...more >>

insert no. automatically
Posted by h at 4/27/2006 10:05:33 AM
Hi, I have a table with 400-500 records, I want to insert srno (1,2,3....) to each record, How can I ? HSS ...more >>

How to connect two SQL Server using private network.
Posted by Mark at 4/27/2006 9:34:02 AM
Hi All: I have two SQL Servers physically sitting next to each other. These servers have Public IPs as 10.10.49.123 and 10.10.49.124. These two servers are also connected through Cross Over Cables for Private Network and private non routed IPs are 192.168.1.2 and 192.168.1.3. I have SQL Se...more >>

Grouping with a full join
Posted by Yan at 4/27/2006 9:25:58 AM
Hi, I would like to know how to group the Amount of both tables while maintaing all Ids. -- Correct results for Table1 select Table1.id ,sum(Table1.Amount) as AmountTable1 from Table1 group by Table1.id order by 1 -- Correct results for Table2 select Table2.id ,sum(Table2.A...more >>

Indexes versus views
Posted by a_pridgen at 4/27/2006 9:13:01 AM
I am currently taking a class, SQL SErver 2000 Database Design and Implementation (70-229) and have just finished reading about indexes. In terms of their primary use, these seem closely related to 'views'. I am unable to find any research on how to know when to use a 'view' versus an 'index...more >>

Can't index functinon-based column
Posted by KJ at 4/27/2006 9:04:02 AM
Hello, I am trying to add an index to a column based on a formula that is a function. When I try to do so, I get the error: 'Line' table - Unable to create index 'IX_Line_LineText'. ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot create index. Object 'fn_GenerateLineText' wa...more >>

text vs varchar as input params for a stored proc
Posted by Keith G Hicks at 4/27/2006 8:59:34 AM
A few years ago when I started working with MS SQL I looked into how to pass a temp table into a stored procedure. The answer I got from most everyone was that you cannot do this but you can pass in a string and convert it to a table within the procedure. I've been doing that since and it works j...more >>

Replacing a single quote
Posted by JasonDWilson at 4/27/2006 8:47:02 AM
How can use the REPLACE function to replace a single quote in a string in T-SQL? I have tried using double quotes, but cannot get it to work. I am trying to replace all the single quotes in at text field with a question mark. for instance: REPLACE(myfieldwithquotes,"'",'?') -- Jason...more >>

Trigger doesnt work on Importing through DTS
Posted by pmud at 4/27/2006 8:28:02 AM
HI, I have the following trigger on Insert for my table. This trigger basically ; when an order is inserted; takes the ID of this row and generates a MasterOrderNo for this order/row and also it inserts the status for this order in the OrderStatus Table. But the problem is that when I d...more >>

Help with a Query
Posted by Matthew at 4/27/2006 8:10:45 AM
Is there a way to optimize this query, by doing it in fewer steps? Perhaps by only utilizing and updating one table? -TIA- [code] /******************************************** Import the data from DBCC SQLPERF(LOGSPACE) ********************************************/ CREATE TABLE #dbcc_sqlp...more >>

Query to get name of views which reference a give column from a ta
Posted by Rodger at 4/27/2006 7:07:01 AM
Hi Can somebody give me a query to find the name of all the views which reference a give column name of a table ex: i want to find names of all views which have the column account_type from the table accounts. Thanks Rodger...more >>

+ char(45)+
Posted by Jaco at 4/27/2006 6:47:02 AM
Hi, Can anyone tell me if I am using this (+ char(45)+) with the right syntax Select E.EventID, IPP.InventoryPMPeriodID Into #TMP From InventoryPMPeriod IPP inner join InventoryPM I on I.InventoryPMID = IPP.InventoryPMID inner join Event E on E.ReportedBY = I.PMDescription + char(45)...more >>

Query to find default value for a column
Posted by JasonDWilson at 4/27/2006 6:45:02 AM
Where are the default values for a column stored in SQL Server. I thought they would be in the syscolumns table, but I cannot find them there, nor anywhere else for that matter. Thanks, -- Jason...more >>

Deletion - best practices
Posted by Sandy at 4/27/2006 6:40:02 AM
Hello - I am using VB 6 for a front end and Sql Server for the back end. I have several lookup tables and a main table in the database. The Admin users need to add and delete items from the lookup tables occasionally. (They don't really have to be deleted; they just can't appear as choic...more >>

Top 10 clients per case type & country
Posted by Dan Bridgland at 4/27/2006 5:37:18 AM
I'm trying to create a report in MS Query Analyzer for the top 10 clients per case type and country with a count of the clients cases per case type and country. here is the sql I have created. Select Count(case.case_id) as case_count, case_type_label.case_type_text, country_name.country_n...more >>

Which query will be faster ?
Posted by Malkesh at 4/27/2006 5:23:02 AM
Hi all, Which query will be performing faster and why? 1. select 'Report' as [Item Type], i.[Name], i.[Description], i.ProductGuid _Product, i.Guid _Guid from Item i where Guid in (select Guid from vReport) or 2. select 'Report' as [Item Type], i.[Name], i.[Description], i.ProductGui...more >>

Group By question
Posted by McA at 4/27/2006 4:58:18 AM
Hello! I would like to get my result grouped by 15 min or 30 min instead of 1 min like I have now, see below. Can anyone help me ? Any ideas? select count(*)AS Count_Case, MIN(CAS_DT_OPE) AS TIME_DATE from s_case (nolock) where CAS_USG_PK_OPEN=255543 AND day(CAS_DT_OPE)=day(getdate()) AN...more >>

Safe encryption of stored procedures for SQL-Server 2000
Posted by rst at 4/27/2006 4:56:08 AM
Is there a safe method to encrypt stored procedures, triggers, functions etc. under SQL-Server 2000? The WITH ENCRYPTION option in T-SQL is not safe and easy to decrypt. I want to create a demo CD with MSDE (Microsoft SQL-Server Desktop Engine). But it must not be that everybody can read the T...more >>

DATEDIFF
Posted by anm at 4/27/2006 2:59:01 AM
I am trying to get the date difference from a given date and work out the number of calendar days, which is fine and then work out the number of saturdays and sundays seperately but I think I'm only getting weekends. The SQL is: UPDATE not_swcch SET not_swcch.Calendardays = DATEDIFF(day, ...more >>

Linked server connection
Posted by checcouno at 4/27/2006 12:26:01 AM
I use a system with one main server (SQL 2005) and three other remote linked servers. I need to know if one of remote server is running or not to avoid my procedure fails. My procedure contains remote query and distributred transaction. If one of the remote server is not running and i know, i ...more >>


DevelopmentNow Blog