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 2006 > threads for monday june 5

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

Connection from command prompt
Posted by MUKUT at 6/5/2006 11:54:24 PM
All, Though sound silly, but I require it by any chance... I need to connect to the sql server 2000 from command prompt and then I need to run query and see the resultset. Any suggestion...?? ...more >>

Rescursive Sort Sql Server 2005. How to sort by name in a function (see example)
Posted by Andreas Klemt at 6/5/2006 11:10:23 PM
Hello, I have this example. My question is, how can I sort after "sortcol" and "empname" ? I mean, I get with this function all the nodes sorted but behalft the nodes I want to sort to "empname". How can I do this? WITH NodeTree2(empid, empname, mgrid, depth, sortcol) AS ( SELECT empi...more >>

nvarchar = utf-16?
Posted by Raymond Du at 6/5/2006 7:53:52 PM
Hi Guys, Is nvarchar the same as UTF-16? If yes, isn't it true UTF-8 is more popular? TIA ...more >>

Permissions
Posted by Baldy at 6/5/2006 4:43:01 PM
Hi All I would like to run a job that checks for any stored procedures without PUBLIC access and grant them public access. What would be the best way to do this and which tables/sp do i have to use? Thank you in advance....more >>

Why do triggers fire?
Posted by RLJONES39 at 6/5/2006 3:59:18 PM
Does anyone know why sql after triggers should fire when there are no records affected? It seems rather redundant for the trigger to have to check. ...more >>

how to update time portion of datevalue to 00:00:00?
Posted by Rich at 6/5/2006 3:37:02 PM
Hello, I need to change a datevalue from 2006-05-12 07:34:00 to 2006-05-12 00:00:00 --basically remove the time portion of the date value. How to do this? Thanks, Rich ...more >>

Converting to ANSI joins
Posted by phils at 6/5/2006 3:14:25 PM
Is it possible to convert the following query to use ANSI join syntax? It may be already but I'm suspecting the "WHERE t2.table_id = t1.table_id" means it isn't. I tried things like the bottom query but the number of records returned doesn't match. Any help would be appreciated. I can't give the...more >>

finding lower case data
Posted by Alien2_51 at 6/5/2006 3:14:01 PM
I have a table with a VIN number column, I need to find all entries where the VIN contains a lower case character, example '4d0131P2X4E146985'. This record should be included in the results because it contains 'd'.. What would be the easiest way to write a query to return these, can I use regu...more >>



Simple select question
Posted by DBC User at 6/5/2006 2:57:21 PM
I have a master table, which has 3 columns which are integer values. I have another reference table, which has integer to string translated, could can I get the string representation of the integer for all 3 columns in a single query. Example: Table A has name, age, sex, ref1, ref2, ref3 a...more >>

syntax of UDF
Posted by kohai at 6/5/2006 2:50:02 PM
Hi, I'm very new to SQl server and trying to learn how the different pieces work. (Currently using v2000) I am trying to write the function below to sum 4 fields if they are all avail, or use a 5th if the all previous 4 are not avail. When I hit the check syntax, it says "incorrect syn...more >>

Update Question
Posted by David Olsen at 6/5/2006 1:43:24 PM
If you update from one database to another, what is the order of qualification? Is it Database.table.user.column If so, what is wrong with the following? USE Sales2 -- Sales2 is the database we are using, Sales1 is a completely different database where some important informat...more >>

How to get missing rows?
Posted by John Riddle at 6/5/2006 1:02:02 PM
Hello, I've got a table in SQL Server 2005 that contains a column of unique id's that range between something like 1123454 and 2985763. What I need to do is order by this column (easy to do) and then find the quickest way to loop through each column and get just the missing numbers. Such as...more >>

Order By Date Format
Posted by Brian at 6/5/2006 12:30:28 PM
I have inherited some code with a view that formats dates like Mar 26, 2003 May 06, 2006 Jun 05, 2006 Example SELECT DISTINCT TOP 5000 createDate, responsibilities FROM vw_someview ORDER BY createDate DESC,responsibilities the order by doesnt come out right. The view select for the ...more >>

Ansi_Padding - how to get rid of
Posted by Sandy at 6/5/2006 12:18:01 PM
Hello - I copied and pasted a database (and log) from Sql Server 2000 to Sql Server 2005 (and attached it). Everything appeared okay until my VB 6 app had problems with its comboboxes. I realized that Ansi_Padding was automatically put in by Sql Server 2005 (it wasn't there in Sql Serve...more >>

complicated query
Posted by VJ at 6/5/2006 11:53:34 AM
I have a table which has 4 columns Sales_person, vehicle_id, price, date I want a query to return names of the sales persons who sold the vehicle at a record price in the month of may 2006. say if sales person A sold a car for 25k in April 06 and 26k in may 06 I want the record high price...more >>

Need help on joining tables
Posted by Learner at 6/5/2006 11:34:21 AM
Hi, I have around 8 tables that I need join and get the data from. 1) 'VEHICLE' the main table --------------- VehicleID(pk) MakeID ModelID Year .... ------------- 2)ContractInfo ----------------- ContractID(pk) VehicleID CustomerID MaturityDate ....... ------------------ 3...more >>

problem inserting data in table - all rows are not returned
Posted by VJ at 6/5/2006 11:12:26 AM
The procedure is inserting data into this table : create table temp_XML (xml_data varchar(8000)) I ran the trace and proc is running fine. But all the data is not returned when I do select * from temp_xml. I did some research and limited data by using a where clause. The proc ran fine ...more >>

Filtering GROUPs to a single row.
Posted by Kevin Burton at 6/5/2006 10:14:01 AM
I have a table: CREATE TABLE [dbo].[NewTable]( [NodeId] [bigint] NOT NULL, [AttributeType] [int] NOT NULL, [AttributeValue] [varchar](8000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Version] [varchar](8000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL NodeId and AttributeType are ...more >>

having clause and where clause
Posted by nick at 6/5/2006 9:36:02 AM
for the following SQL statement select .... group by col1 having col1 is not null Does it always return the same result as select ... where col1 is not null group by col1 ? The "where" one should have better performance, is it always true?...more >>

multiple triggers
Posted by Cynthia at 6/5/2006 9:15:02 AM
How can I set it so one trigger runs before another? I have two triggers on a table and I need for one to run before the other. Also is there a good book I can get that will explain writing triggers?...more >>

Access permissions on stored procedures.
Posted by MittyKom at 6/5/2006 9:09:03 AM
Hi All Is there a way to find out what access permissions have been granted to all stored procedures in my database? Thank you in advance. ...more >>

Altering a stored procedure
Posted by SAM at 6/5/2006 9:03:02 AM
I am modifying a stored procedure to perform a check before updating the table. I wanted to run tnis if else stmt to see if there is a better way to perform the task. The original sp generates a account number for a customer and updates the table with the new account number. I want to ad...more >>

I WANT TO DISPLAY ALL THE MONTHS BETWEEN 2 DATES FROM TABLE
Posted by akpatelrs NO[at]SPAM googlemail.com at 6/5/2006 7:45:23 AM
Hi My requirement is to display names all the months between two dates from the table. I have lots of START and STOP dates available in my table and I need to display names of all the months including Start and Stop months. How can I do that, with function or with some loop. My database is SQ...more >>

Stored Procedure does not return any results
Posted by Mario G. at 6/5/2006 7:19:02 AM
Hi All, I have a stored procedure with a single parameter that does not return any results. However if I execute the same select statement (replacing the parameter) into the Query Analyzer it returns 2 items. Here is the stored procedure: create proc sp_Find @Item_List nvarchar(88) as ...more >>

Stored Procedure breaks and stops - uses cursors
Posted by VJ at 6/5/2006 7:17:07 AM
Posted - 06/05/2006 : 10:16:03 -------------------------------------------------------------------------------- I have a stored procedure which was running fine few minutes ago but not it just breaks and stops right before its about to end. The procedure is inserting data into this table : ...more >>

select from group and search for a lvl 2 user
Posted by Sobert at 6/5/2006 6:51:02 AM
Hi. I would like to implement an SQL stored procedure that : select * from group and for each group, search for a lvl=2 user in the user table I can't change the DataModel :/ Thanks....more >>

Unable to open BCP host dat
Posted by Shailesh at 6/5/2006 5:50:02 AM
Hi All, I am working with BCP and try to create a file on a remote machine through BCP. But when I try to create file I am getting following erre. Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file Can any body guid me how to solve this? Regards, Shailesh...more >>

rename column
Posted by mcnews at 6/5/2006 5:18:01 AM
i need t-sql syntax for renaming a column. the column name contains the [] characters. alter table <tablename> rename [old field name] to NewFieldName isn't working for me. tia, mcnewsxp ...more >>

MDX question
Posted by Oded Dror at 6/5/2006 5:10:58 AM
Hi there, In SQL Server 2000 we use to have Sample (MDX tools) application That you can execute an MDX query Where in SQL Server 2005 I can write an MDX quiry and execute? Thanks, Oded Dror ...more >>

Deleting filesystem files
Posted by SqlBeginner at 6/5/2006 4:40:02 AM
Hi All, I need a generic solution to delete backup files from filesystem in order to reduce space. Can this be done using the extended sp "xp_cmdshell"? If yes, can any body show me an example on how to achieve this. ie.., i want to write a SP and add it to SQL Jobs. I want that SP to d...more >>

Help needed with Transaction Logs
Posted by Peter Newman at 6/5/2006 3:42:01 AM
i keep getting a message stating that the disk is fulkl so i have been trying to shrink the database to start with using the following code USE [BossData] GO DBCC SHRINKDATABASE(N'BossData', 50 ) GO All i get is the following error Msg 0, Level 11, State 0, Line 0 A severe error occur...more >>

problem of UNION query
Posted by kym at 6/5/2006 2:31:01 AM
I maked a following query and excuted it. SELECT UT.shop, sum(UT.dcrate) , sum(UT.sellcnt) FROM ( ( SELECT SUBJ0.shop AS shop, 0 AS dcrate, sum(SUBJ0.sellcnt) AS sellcnt FROM ( SELECT [shop]shop, [brnd]brnd, [item]item, [seq]seq, [color]color, [siz...more >>

Color
Posted by Earl at 6/5/2006 2:14:19 AM
Is color an attribute or an entity? ...more >>

sql 2000 table format
Posted by farshad at 6/5/2006 1:43:01 AM
There is a table with the following fields: id,year,UserCode,A2,A3,B2,B3 Usercode is a varchar fields whereas the other fields are integrers. Let's say this is what the table contains at present: id year Usercode A2 A3 B2 B3 1 2005 2BM 12 7 9 11 2 2002 BB1 87 98 4 32 3 1999 3NS 45 3...more >>

How could I get the records recusrively (nested)?
Posted by DJ at 6/5/2006 1:29:50 AM
How could I get the records recusrively (nested)? I've a table ACCT with columns as follows. ACCT_CD varchar(20) TYPE_CD varchar(1) It has following data. ACCT1 F ACCT10 F ACCT2 F ACCT3 F ACCT4 F ACCT5 F ACCT6 F ACCT7 F ACCT8 F ACCT9 F GRP_1 G GRP_2 G SGRP_1 C SGROUP C ...more >>

Taking SQL database offline programmatically
Posted by shailesh_birari NO[at]SPAM rediffmail.com at 6/5/2006 1:08:55 AM
Can some give me some pointers to code/APIs to take a SQL 2005 database offline. I have written some code using SQL-DMO to do log reply on a sql 2005 database. Now I want to take the SQL database offline through my code. Is it possible using SQL-DMO .,. how.? I will be thankful for any help in ...more >>

How to remove time from date?
Posted by Edmund at 6/5/2006 12:00:00 AM
Hello, I have a table (T1) that has a field that holds a date with a time. In another table (T2) I have records related to T1 on an ID field (one T1 to many T2). T2 has a date field also, but this field does not have time (ie the time part is midnight). I want to join the two tables o...more >>

Best method for maintaining list?
Posted by John at 6/5/2006 12:00:00 AM
Hi All, I am wondering what, if any, method would best suit the following request. I want to maintain a list of items in SQL Server. I'm thinking a Stored Procedure. The list is of two columns: (both VarChar) colName, colTag data: Name1, Tag1 Name2, Tag2 Name3, Tag3 Name5, Tag4 No...more >>

Null value problem
Posted by Samuel Shulman at 6/5/2006 12:00:00 AM
Hi I sent the following query 'Update TableA SET F1 = F1 + F2' and where the value of F2 was Null then the value of F1 became Null even where the original value of F1 was NOT Null Is that the way it suppose to work? Thank you, Samuel ...more >>

A Tale of Aggravating Aggregates and a request for a new direction.
Posted by Mark S. at 6/5/2006 12:00:00 AM
Once upon a time there was a real time sales stats program using a SQL Server 2000 Standard Edition on dedicated 1 CPU 1 GIG RAM server. In the beginning data came in nice and slowly and this query worked just fine: BEGIN TRAN IF EXISTS ( SELECT rowID FROM tbStatsNam...more >>

distributed transaction w 2 servers in different domains
Posted by Tom at 6/5/2006 12:00:00 AM
Setting up distributed transaction between 2 servers from the same Windows domain is no problem, but when I try to do it with 2 servers from different domains i get error: Server: Msg 7391, Level 16, State 1, Line 9 The operation could not be performed because the OLE DB provider 'SQLOLEDB' w...more >>

Database Corrupt: error 823
Posted by Roy Goldhammer at 6/5/2006 12:00:00 AM
Hello there After i tried to run DBCC CheckDb and it gave error, i has made to detach the database. When i tried to attach i got error 823: error (Bad page id). What i can do now to fix the MDF file? ...more >>

Database damage
Posted by Roy Goldhammer at 6/5/2006 12:00:00 AM
Hello there I tried to run simple query on one of my database. Afrer 5 hours of work i tried to stop it and the sql didn't let me to stop. Therefore i had do shut down the server and run it again. When i run it again the server has come up and the database become gray with (suspect). ...more >>


DevelopmentNow Blog