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 friday january 20

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

remotely start/stop sql server service in a workgroup
Posted by Fred at 1/20/2006 10:38:58 PM
hi, i have an administrator account on a box, there is a sql server pc in the same workgroup w/ a different admin pass (which i know ^_^, and the sql sa pass too), how can i restart the sql server service from my box ?...more >>


union ?
Posted by Fred at 1/20/2006 10:35:10 PM
hi, i have tables Customer, CustomerGroup and CustomerCustomerGroupXref ( :) ), now i want to find customers having say vip_flag, only that flag can be set for whole gropus and the indivdual customers inside group wont than have it set curenty i do select id, code from customers where v...more >>

Order By Primary Key
Posted by INeedADip at 1/20/2006 8:46:52 PM
I've got a table with an a primary key of type 'int' (auto incrementing). Were talking about millions of rows. The name of this field is TempID. I always want to sort by the TempID ascending....is that something that I even need to specify? When I query it in Query Analyzer it seems to alw...more >>

[ot] VBA workgroup / domain name
Posted by rmanchu NO[at]SPAM gmail.com at 1/20/2006 8:10:43 PM
hi i'm being asked to log, users workgroup_name and domain_name in an audit trail? is this do-able? how shud i proceed on this? thanx ...more >>

Use of TABLOCKX
Posted by PD at 1/20/2006 7:16:02 PM
I have a stored proc that generates keys based on an existing table row. Here's the code: ===== CREATE PROCEDURE [GetNewID] @newID char(4) OUTPUT AS DECLARE @lastID char(4), @userIDNum int -- Get the latest existing userid from Users and put it in the Reference table IF NOT EXISTS(SELEC...more >>

How to remotely start SQL Server instance?
Posted by Igor Solodovnikov at 1/20/2006 6:36:45 PM
When you connect to SQL Server instance using SQL Query Analyser there is "Start SQL Server if it is stopped" option. Is it possible to remotely start stopped SQL Server instance from my custom application? How?...more >>

Identity Values
Posted by Ferdinand Zaubzer at 1/20/2006 6:23:19 PM
Hello, I have the Following Problem: I have some tables on a SQL Server database that have primary keys without the identity property. This was necessary for importing data from old databases... Now I want to change some primary key columns to be an Identity. Of crourse the identity seed sh...more >>

instead of trigger on view
Posted by Michael Schroeder at 1/20/2006 6:21:14 PM
Hi I have a view 'vwTest' that is based on 'table1' and 'table2'. Whenever a new entry appears in that view i'd like to fire a trigger that inserts the new data into a third table named 'results'. If there's an insert into the basetables I can see the new entry in my view but my trigger ...more >>



stored proc help
Posted by Mike P at 1/20/2006 5:18:27 PM
I'm trying to create a stored proc where the season and team name of a sports team are passed to it, and it returns the week, opponent and scoreline of the game, plus a path to the opponents logo. The fields i am working with in the table are season, week, hometeam, awayteam, homescore and away...more >>

Text file import
Posted by Grace at 1/20/2006 4:58:02 PM
I have multiple text files need to be imported into SQL server. All files use same column delimiter, row delimiter but have different number of columns. Some have over 100, some have just 10 or 20. I am wondering if there is a way to import them together, not one by one. Thanks for the help!...more >>

TRIGGER UPDATE QUESTION
Posted by ReTF at 1/20/2006 4:52:37 PM
Hi All, If I have one UPDATE TRIGGER to table 'TA' and in this trigger I have one UPDATE to the same table TA, this will stay in infinite loop? Thaks ...more >>

Yukon and intellisense?
Posted by brett at 1/20/2006 4:38:57 PM
I've seen references that Yukon does have intelliesense. Is this full blown intellisense or something stripped down? Are there any web references describing some of its details? Thanks, Brett ...more >>

SQL Server Express 2005 and VS.Net 2003
Posted by Good at 1/20/2006 4:02:49 PM
Dear all Is Visual Studio.Net 2003 compatiable with SQL Server Express 2005? I have tried to use the Data Form Wizard to link with the SQL Server Express 2005 but "There were errors configuring the data adapter" error shown after selected the desired table. Could anyone help? Thanks Ale...more >>

Select where result are by the best match
Posted by Senna at 1/20/2006 3:40:02 PM
Hi Looking for a way to get the right product tax depending on the zip code. The query should look something like below, but don't know how the expression for the zip code matching should look like. ISNULL(SELECT Tax FROM ProductTax WHERE ProductId = @productid AND CountryId = @countryid...more >>

Biztalk 2004 & SQL
Posted by Johnson at 1/20/2006 3:30:34 PM
I have some questions about how to determine if my Biztalk 2004 is using connection pooling or not. Also, I would like to determine if the Microsoft Biztalk 2004 application uses OLE DB, or ODBC for its connection to SQL Server 2000. Also, how can I trace the info or statistics? Thanks ...more >>

Creating a table
Posted by John at 1/20/2006 3:19:46 PM
I have a recordset that consists of among other things a list of values and dates over the next 12 months, I want to display these dates in a table ie Jan Feb Mar Apr May Jun etc 12 80 120 5 65 56 etc The months are on a 12 month rolling table, how would i achieve this, perh...more >>

variable for DateAdd datapart constant
Posted by WCL at 1/20/2006 3:04:54 PM
Can DateAdd accept the datepart parameter as a variable? e.g declare @start_date datetime declare @end_date datetime declare @adjustment int declare @adjustment_units ??? -- set the input values -- set @end_date = DataAdd(@adjustment_units, @adjustment, @start_date) ...more >>

Verify if a Table Exists
Posted by Paul DeWitt at 1/20/2006 2:13:03 PM
Is there a command to verify that a table exists? I am writing a .Net application. I would like to have the .Net application check if a table exists (initiated by a menu command) and then create the table if it does not exist. Is there a similar command to verify if a field exists in a tabl...more >>

getting today's data in '2006-01-20' format
Posted by hazz at 1/20/2006 1:20:39 PM
I would like to use today's date in the format as below ('2006-01-20') How do I format the result of GetDate() to achieve that? Thank you. -hazz declare @now datetime set @now = '2006-01-20' SET DATEFORMAT ymd; declare @now datetime set @now = GetDate() ...more >>

sa password
Posted by Igor Solodovnikov at 1/20/2006 1:11:00 PM
Is there default password for sa user in SQL Server 2005 Express Edition?...more >>

Clean out (Reinitialize) SQL Server Database?
Posted by Joseph Geretz at 1/20/2006 1:02:51 PM
It there an easy way to 'clean out' a SQL Server database? I need to get a database of an unknown state back to a known state of 'empty'. Is there an easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS, INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?) (I don't want ...more >>

Table to comma delimited
Posted by Matt Sonic at 1/20/2006 12:59:04 PM
Looking for a little function/trigger writting help. I need to convert data in one column of a table/view to a comma delimited string in a single field in a related row on another table. I want to use a trigger for when a table is either appended, deleted or updated in SQL Server. Can you...more >>

Data Compare
Posted by Joe at 1/20/2006 12:58:58 PM
I have and use Red Gate software for comparison. However; I'm at a loss on this data compare scenario: I have two tables I want to compare, but the PK-ID field is seeded differenly between the 2 tables. So when I do a comparison - every row is considered different. I looked at a couple o...more >>

Changing NULL to zero
Posted by CL at 1/20/2006 12:49:33 PM
Greetings folks, I have a dilemma that I thought was going to be a slam dunk. I have a table with several integer and money columns that contain about 50% null values. I need to sum them, and have the nulls treated as zero. Secondly, I need to insert all of the values into another table. ...more >>

Can I write query like this
Posted by Nick at 1/20/2006 12:24:20 PM
hi, guys Can I write query like this: I need to get the amount of stores that have @PID inventory less than 2 select count(*) from ( select StoreID, sum(Inventory) as Inv from products where productID = @PID group by storeID ) StoreInv where StoreInv.Inv <= 2 thanks. ...more >>

is there a way to get listing of table relationships
Posted by Rich at 1/20/2006 12:02:02 PM
Hello, I am examining the relationships, indexes, constraints of tables in a DB that I am supporting. There is no documentation, so I want to get a listing of the relationships rather than just looking at the database diagram and examining each table individually. I looked at informatio...more >>

where current of cursorName
Posted by jaylou at 1/20/2006 11:53:02 AM
Hi all, I am trying to sequence rows in a table. this is for differnt policy#'s I am using policy#,effectiveDate as my critiria to start my numbering. The problem is there are no unique Identifiers in this table I have 6 rows that are exact dupes. when I run a normal cursor, it updates all...more >>

Varbinary columns...
Posted by Tudor S at 1/20/2006 11:51:04 AM
Hello all, I'm working on a SAP database which I have to connect to a telephony exchange database. Both databases are installed on a SQL Server 2000 SP4 machine. I have to create a view over those two databases; the join columns have actually different type of data: the one in SAP is varbi...more >>

Changing the Table Type
Posted by CSHARPITPRO at 1/20/2006 11:45:01 AM
Is there a to change the Type property on a table? I would like to be able to change the Type from 'User' to 'System' through code. Adv-thanks-ance...more >>

Stored Procedure to Delete Rows
Posted by Dooza at 1/20/2006 11:38:38 AM
Hi there, I have made this statement that will select credit card details from one table if the order status is shipped in another table. SELECT dbo.tblOrderDetails.orderStatus, dbo.tblCreditCardDetailsTest.orderNumer, dbo.tblOrderDetails.cName, dbo.tblCreditCardD...more >>

ASP.NET * Cannot find file
Posted by Terry at 1/20/2006 11:16:04 AM
When launching created file 'eSurvey.aspx' the following error occurs. How can I resolve this matter? Thanks! ERROR: Could not find a part of the path "E:\Documents and Settings\wardte\Desktop\eSurvey\convert\files\Rigid_PCB_Questionnaire.htm". Description: An unhandled exception occu...more >>

DateTime Bugs??
Posted by Kenny at 1/20/2006 11:07:04 AM
Hi, Below shown simple script to get the weekday. Any idea why the weekday for spanish datetime is 1 instead of 2 for 'Ene 16 2006 2:00PM' ('Jan 16 2006 2:00PM') ?? TEST ------ print DATEPART(dw,'Jan 16 2006 2:00PM') SET LANGUAGE spanish print getdate() declare @datetime dateti...more >>

TreeView Populating problem
Posted by JN at 1/20/2006 10:56:21 AM
Hi All, I am using an SqldataAdapter to fill a dataset table: Dim dadEmployees As SqlDataAdapter = New _ SqlDataAdapter("SELECT FirstName + ' ' + LastName AS FullName Employees", con) Dim dst As DataSet = New DataSet() dadEmployees.Fill(dst, "tbEmployees") ...more >>

Inline table function help
Posted by .... at 1/20/2006 10:42:29 AM
Hi I have a table looks something like this CREATE TABLE TEST ( theid INT, thevalue TEXT ) Example Data theid thevalue 1 1000,2000,4000,7000 4 8000,2000,38383,333 From this table I want to create an extr...more >>

Problem copying data from column in same table
Posted by Iris Faber at 1/20/2006 10:26:14 AM
I have a column that I would like to copy data to. The column definitions = are exactly the same. I tried creating an Insert Into query and changed = the type to Insert Results. Everytime I run this query, all the values in = my column remain to be null. Below is a sample of what I did: IN...more >>

How to add sproc to multiple databases
Posted by bill NO[at]SPAM internetbazar.net at 1/20/2006 10:23:47 AM
Hi all. Lets say I had a script to run (create sproc) and I needed to run it on several different databases on one sql server. Can someone give me an idea how I could do that short of changing the "use databse" line each time? Thanks ...more >>

sending results of query into a table
Posted by hazz at 1/20/2006 9:04:39 AM
A colleague is going to automate (using Reporting Services) a daily report using the following sql. He asked that I put the results of this query into a table. How do I do this? Thanks. -hazz declare @now datetime set @now = '2006-01-20' select count(Create_DT) from customer where varDT ...more >>

Throwing Errors In VB Script From SQL Job
Posted by Doug at 1/20/2006 8:57:05 AM
Hi, I am creating a SQL Job and using a VB Script inside of it. In the script, under certain conditions I throw an error. When I test the script under those conditions, I get notification the error occurred, but not what the specific error is. With TSQL commands inside a job, it allows yo...more >>

Really really slow cursor
Posted by Si at 1/20/2006 8:29:03 AM
I'm stumped on this. My developers proc left to run all night consumes tons of cpu but does no updates at all and I have to kill the connection in the morning. The select in the cursor declaration returns 357 rows so not an outrageous result set. When I run the select in Qry Analyser it r...more >>

Joining Tables
Posted by John at 1/20/2006 8:21:20 AM
help please I have two tables I want to join, Table 1 (T1) nd Table 2 (t2). Table 1 has several fields A1,B1,C1......... etc and Table 2 has several Fields A2,B2,B3 etc I want to join A1 to A2, which is simple enough, but then I want to join B1 to B2 based on the field value in B1 being ...more >>

Not like operator seems to be being ignored in Trigger
Posted by Kendra at 1/20/2006 8:06:02 AM
I'm trying to find out if the "not like" operator is ignored in triggers. I have a fairly simple trigger, but it is firing for all inserts, disregarding the "IF @CustomerName not like '%solec%' RETURN" statement. I even set the name to null thinking it may have been holding onto something...more >>

Have Svr name, need DBs
Posted by Bob at 1/20/2006 7:15:27 AM
Hello Folks! I have a bunch of servers, actually there are about 340. I have the names of the servers but what I'd like to do is loop through the servers and return all the databases on those servers. I'd also like to find out how busy the servers are. Got any ideas? Thanks-In-Advanc...more >>

xp_readmail
Posted by baddy at 1/20/2006 6:25:48 AM
Can anyone tell what's the replacement for xp_readmail in SQL Server 2005? All I could find in BOL was: This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature...more >>

Hyperlink
Posted by GTN170777 at 1/20/2006 5:56:03 AM
Hi All, Silly question, but what is the best column type for hyperlinks? Many thanks...more >>

How can we CREATE a VIEW with variable which stores a select stat?
Posted by savvy at 1/20/2006 5:32:27 AM
The code shown below is working perfectly in the analyzer. I want to create a view with the results Is it possible ? Thanks in Advance DECLARE @searchstring varchar(22) SET @searchstring = 'aspnet' declare @strSQL varchar(244) select @strSQL='select FileName,Path from scope('''' "c:\inetpu...more >>

finding the difference from one row to another
Posted by polluxopera NO[at]SPAM gmail.com at 1/20/2006 5:03:59 AM
Hi there... I have a table with this data: id entered_time 1 2:38:33 PM 2 2:54:45 PM 3 3:03:23 PM What I need to do is figure out the time difference between the entered_time values in row 1 and row 2, row 2 and row 3, etc., but I'm not sure how to do this. ...more >>

Update one table from another table
Posted by Carl at 1/20/2006 5:01:02 AM
Hi. I want to update table1 from table2. table1 ID D1 D2 D3 1 2 3 table2 ID D 1 X 1 Y 2 Z After the update I want table1 to look like this: table1 ID D1 D2 D3 1 X Y 2 Z 3 Is't possible to do? Thanks for any help. Carl...more >>

reverse like?
Posted by chandy NO[at]SPAM totalise.co.uk at 1/20/2006 4:07:33 AM
I am trying to do the equivalent of following pseudo-code: select id from tablename where %stringcolumn like 'mystring' so I would have a record returned if the values in stringcolumn were: ystring string tring ring etc.. To me this seems like some kind of backwards 'like' but I ca...more >>

Case Within Where Clause
Posted by Sh0t2bts at 1/20/2006 3:46:54 AM
Hi All, I am written a query that runs each day and pulls all of the work logged by an office, it works fine Mon - Fri but as the managers dont work Sat-Sun they want my report to show all work from the weekend. Here is my current where clause:- Where Sta = 0 and query_source = 1 and User...more >>

Can't we use variables in OPENQUERY, FREETEXT("@searchstring")?
Posted by savvy at 1/20/2006 3:14:14 AM
I'm writing a stored procedure for a keyword search in a Word or PDF doc which i've done through Index Server and linked the results to SQL Server. Part of my stored proc is shown below in which for a FREETEXT keyword search i'm using a variable "@searchstring", which i have to, is not working....more >>

Calling webservice from CLR Stored Procedure
Posted by .LP at 1/20/2006 3:01:02 AM
I would like to be able to call an webservice from a SP, I'm able to add a webreference to the webservice in the database project, but how to call it in code, and how to set up the code access illudes me? any suggestions? ..LP...more >>

Program Logic
Posted by marcmc at 1/20/2006 2:36:04 AM
My program runs a number of batch files. I use a parameter table as below to loop thru what commands should be fired in Exec master..xp_cmdshell @pCommand ; For ev_id 4,5,6 & 7 I want to add an if statement to only execute one of them. I can't seem to work out the logic. With current logic ...more >>

Is it possible to use a Function directly as a Input Parameter for a Inline UDF
Posted by Franz at 1/20/2006 1:47:09 AM
In a Scalar-valued Function i can give a other Function (System or UDF) directly as Input Parameter. In a Inline Function and Table-valued Function it doesn't work. See the samples: -- Create this Function as a UDF Inline Function ALTER FUNCTION dbo.TestFKT2 ( @strSUSER varchar(256) ) ...more >>

Job LastRunOutCome??
Posted by Phonzo at 1/20/2006 12:40:48 AM
Hi all, I am trying to determine the status of a Job after it has finished running, but I don't get the correct results: I first check if the Job is currently Running: Private Function isJobExecuting(sJobName As String) As Boolean Dim JobServer As String 'Execute a SQL Server...more >>


DevelopmentNow Blog