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 > march 2007 > threads for wednesday march 14

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

Utf16
Posted by Charles Bazi at 3/14/2007 10:24:43 PM
Hi, I have a VARCHAR and I need to get Utf16 bytes of the VARCHAR. Is there any integrated function ? I work with SQL Server 2000. I do it in c# this way: byte[] binaryData = Encoding.Unicode.GetBytes( "sample" ); Thank you......more >>

Needs to create a batch file
Posted by Remo at 3/14/2007 8:44:25 PM
Hi All, I need to create a batch that generates the output of a query into a text file.The batch file I created goes like this, but it is thrwing login error.Please help me.try to give me a complete bacth file. @echo off echo Hello this is a test batch file set mysqlcommand=select * from e...more >>

Reading a file inside a Stored Procedure.
Posted by Sathian at 3/14/2007 8:36:58 PM
Dear All, Inside a Stored Procedure, we need to access a folder to read a text file. we use the following statements : DECLARE @SQLQUERY nvarchar(1000) set @SQLQUERY= 'BULK INSERT ars.attendance_Temp FROM ''' + @FilePath + ''' WITH ( FIELDTERMINATOR =...more >>

Need select with conditional averaging
Posted by Terri at 3/14/2007 8:10:35 PM
Please help. I have a select with a date range restriction. The start date is always the first of a month, the end date always the last of a month. I want to create a average column but the average needs to be dependent on where there my group has no gaps in the records between the date range....more >>

Sp compilation error
Posted by CTS_DBA at 3/14/2007 8:06:16 PM
Hi guys, I have a problem with a SP, can some one pls help? I have a SP which calls a function. Interestingly.. If I have the function created on the database, all the references of the function with in the SP has to have all the parameters specified, including the ones with default va...more >>

sql SMTP mail
Posted by sam at 3/14/2007 7:58:05 PM
Hai, everyone here. i have set up the sql mail with xpSMTP. actually i can send the mail with successfully but i have a question here is : 1. SMTP can support sql query statement or not? 2. how i can get the results from my database as the message/subject for my mail? ...more >>

SQL Joins - 2005
Posted by RickSean at 3/14/2007 7:34:00 PM
I have two tables TableA and TableB. TableA contains IDs and TableB contains Description for each IDs. TableA has 3 IDs and TableB has 10. How do I join these two table to get Description for 3 IDs contined in TableA? The following return 30 records instead of 3. SELECT Description FROM Table...more >>

Writing to SQL Server Logs from a C# SMO Program??
Posted by Crash at 3/14/2007 6:30:36 PM
SQL Server 2005 ..NET 2.0 Hi, Is there an SMO class available for me to write an event into a SQL Server log? I see the documentation for the LogFile and LogFileCollection classes but I can't find anything that will let me write an entry into the 'current' SQl Server log file. Thanx in...more >>



Help with Query - Calculate Values
Posted by Sasi Novomeiski at 3/14/2007 5:57:19 PM
I have a table with records: id, application, value. How do I calculate the the maximum values for series of records of each consequtive apps? 1 word.exe 1 2 word.exe 2 3 excel.exe 1 4 excel.exe 2 5 excel.exe 3 6 word.exe 1 7 word.exe 2 8 excel.exe 2 9 abc.exe 1 11 exce...more >>

Help with Query - Calculate Process Times
Posted by Sasi at 3/14/2007 5:54:43 PM
I have a table with records: id, application, value. How do I calculate the the maximum values for series of records of each consequtive apps? 1 word.exe 1 2 word.exe 2 3 excel.exe 1 4 excel.exe 2 5 excel.exe 3 6 word.exe 1 7 word.exe 2 8 excel.exe 2 9 abc.exe 1 11 e...more >>

Create table from results of stored procedure?
Posted by J at 3/14/2007 5:07:17 PM
Hello. Would anyone know how to automatically create a new table (not having to define each column and datatype) from a result set of a stored procedure that comes from another sql server that's being linked? Thanks in advance. J ...more >>

Internal SQL Error
Posted by Roy Goldhammer at 3/14/2007 4:57:33 PM
Hello there I have sql server 2000 SP4 I've got this error "Internal SQL Error" in this case: SELECT * FROM Customers C LEFT JOIN (SELECT SerialNumber, max(OrderDate) FROM Orders O WHERE Order type in (2,3,4) GROUP BY SerialNumber having Count(1) > ...more >>

Space between the folder names when deleting files
Posted by MittyKom at 3/14/2007 4:30:08 PM
Hi All How do you would handle the space between the folder name "Default Site" on the below SQL as it is part of the pathname to file DB20070314 to be deleted? I am getting the error that the path to the file is wrong? --------- declare @nqly nvarchar (356),@date char(10) select @date...more >>

who can connect to integration services in SSMS 2k5?
Posted by === Steve L === at 3/14/2007 4:02:35 PM
does anyone know how to grant developer access to integration services? i assigned a developer's account to msdb (dtsadmin, dtsuser, dtsoperator, and targetserveruser ) roles but still he can't connect to integration servics thru ssms (said access is denied). i don't think granting sysadmin r...more >>

Need information about online sistem
Posted by John S at 3/14/2007 3:48:21 PM
Hi All, Currently, I write an inventory application using VB6 and SQL Server. Some of the users need my program to work on remote workstations. But, I do not have experience to do it. I want to get information from you about SQL Server under Windows server that works in an online sy...more >>

How do I connect to a default instance of SQL Server 2005?
Posted by Alan Silver at 3/14/2007 3:41:07 PM
Hello, I have SQL Server 2005 on a development machine, and I can't figure out how to connect to it. In SQL Server 2000, I would have a connection string like... Data Source=server;uid=fred;pwd=fred;Initial Catalog=FredsDB;Network Library=dbmssocn; and this worked fine. This doesn't w...more >>

help with a simple query??
Posted by ChiWhiteSox at 3/14/2007 3:37:07 PM
hi all! i've got this query: select IDAgn as ID,IDBus as 'BusID',PubYear as 'Year' from Chocolate where PubYear > 2005 output is: ID BusID Year 20 31693 2007 20 31693 2007 86 31759 2007 86 31759 2007 86 19348 2007 86 19348 2007 21 31810 2007 21 31810 2007 20 ...more >>

Long lasting schema stability (Sch-S) locks
Posted by Jim Underwood at 3/14/2007 3:29:02 PM
This problem is occuring on SQL 2000 Users of my web site are complaining that the application is hanging at one point in the process. When I look at the locks on the database, I see that they are holding Sch-S locks on a dozen tables. The strange part is, I continue to see these locks for m...more >>

Good SQL Server 2005 tutorial
Posted by David Trasbo at 3/14/2007 3:27:01 PM
Hi, I would like to know where I can find a good complete video-based tutorial for implementing SQL Server in windows forms. -- David Trasbo. Læs om Usenet: http://usenet.dk (Danish)...more >>

How to get the Logical Scan Fragmentation from dbcc showconfig
Posted by Jodie at 3/14/2007 3:00:10 PM
Hi all, Run the dbcc showconfig will displaying the - Logical Scan Fragmentation in perentage and do you know any easy way to get this logical scan Fragmentation programmatically so we take different action depending on the percentage of the fragmentation. Your help is greatly appreciated. JP...more >>

localization information
Posted by Jodie at 3/14/2007 2:55:26 PM
Hi All, Is it true that for database supporting localization the database's objects much define as nvarchar or nvarchar2 for the columns datatype. Thanks, JP...more >>

help with this query - get the orphan lines
Posted by xke at 3/14/2007 2:41:19 PM
I have a table similar with a sitemap. Page InsideLinks ------------------------------ p1 p4,p5,p8 p2 p3,p4,p7 p3 p5,p8 p4 p5 p6 p3,p4,p5 p7 p8 p8 First line means page p1 has links to page p4, p8, p5 and so on. How can I get a list with the orphaned pages, those who are not b...more >>

SQL Query To To set up Mixed Mode security
Posted by Hadidi at 3/14/2007 1:41:15 PM
How can I change the Server authentication mode to Mixed mode using a sql query ?...more >>

Load Data into Server
Posted by Jason Lepack at 3/14/2007 1:09:40 PM
I have a database that loads a file of serial codes into it, but we don't want it to accept duplicates into the table. The original method (the one that I'm changing now) didn't scale well. Every time a code file was loaded, the file was loaded into a dataview and then a stored procedure was ...more >>

Using Newid() to get random records.
Posted by Patrick Hill at 3/14/2007 12:58:58 PM
Hi, I have a SP that grabs data from one taable and poulated another. I needed a way to randomly select x amount of records. I found out about Newid() but here is the thing. In some cases it's returning duplicate records. here is what the sql query I have looks like Declare @NumOfRecs i...more >>

Record compare.
Posted by David S. at 3/14/2007 12:47:30 PM
I have a table that contains the following tbl.acct, tbl.timestarted, tbltimeended, tbl.crew Nearly everytime I have more than one crew involved on an account and so when I query for an account number I get at least 2, sometimes as many as 5 records. I need a way to return only the record ...more >>

Help with Join
Posted by jobs at 3/14/2007 12:25:11 PM
Three tables. ActiveWorkflow uniquekey=workflowno int WorkFlowname WorkFlowHistory fk=workflowno int WFdate Jobname Jobstatus WorkFlowDetail Jobname I need a view that will display every Jobname in WorkFlowDetail with it's Most recent status (by WFDATE) for a...more >>

Using parameters in IDENTITY
Posted by Dream at 3/14/2007 12:10:39 PM
I am a new here and my question is : can i use a parameters in the "seed" IDENTITY ( data_type [ , seed , increment ] ) AS column_name for exemple SELECT Top 219 IDENTITY int,@First_Num,1 as Num INTO #LP FROM Sysobjects cuz i would like to create a sequence that contain 50 elemen...more >>

how to cluster a non-cluster primary key
Posted by Derek at 3/14/2007 12:06:27 PM
i have a table with no clustered index but it does have a primary key. this primary key has foreign keys tied to it. i want to make the primary key clustered. is there a way i can do it without dropping the foreign keys? i need to write a script and can't do it through the sql workbench ...more >>

Grouping Rows Based Time interval between 2 rows
Posted by dwopffl NO[at]SPAM yahoo.com at 3/14/2007 11:28:09 AM
I'm new to sqlserver and still learning, so any help that anyone can give me would be greatly, greatly appreciated.... I have a table EMPID START DTIME END DTIME 10 1/3/07 1:21 PM 1/3/07 17:51 10 1/7/07 7:29 PM 1/7/07 21:42 10 1/8/07 3:13 PM 1/9/07 4:01 20 1/6/07 5:05 AM ...more >>

ok i admit it, I made a mistake on naming conventions
Posted by WebBuilder451 at 3/14/2007 11:27:13 AM
i created a db with old school naming ex: for table named tbl tblID as INTEGER tblFname as varchar(50), tblhourly as decimal(7,2), ..... I can't change the table names because i have about 150 sp and functions, but i will someday that's a given. In the mean time to make my life easier i ...more >>

Import data from one sql server to another
Posted by J at 3/14/2007 11:24:17 AM
Hello. Would anyone know how to import the resulting data set from a stored procedure that's in a SQL2K (server A) into another SQL2K (server B)? Thanks in advance. J ...more >>

Calling a sp on a linked server
Posted by Chris W at 3/14/2007 10:58:08 AM
Hello, I have a linked server established to a DB2 database on a mainframe platform. I can run simple queries easily enough using OPENQUERY and OPENROWSET. I have been trying to invoke a stored procedure on the linked server using these statements but I'm failing miserably! Does anyone know i...more >>

query generated from multiple criteria selections
Posted by PJ6 at 3/14/2007 10:52:38 AM
Say (hypothetical/simplified case) I have a table with 500,000 different unique cars, and the user can query this table based on one or more color selections, ie "all cars with red or blue or green paint". There are 50 different colors a user can select. In addition, there are several other ...more >>

OSQL broken
Posted by nottysymbaz NO[at]SPAM yahoo.ca at 3/14/2007 10:46:50 AM
After installing the windows auto updates yesterday, OSQL can no longer connect to my local SQL server or a network server. ISQL ( a different version of SQLServer) continues to work. OSQL worked for me yesterday. Is this just co-incedence or did the update cause it. (I'm using Windows XP) Any p...more >>

Family Tree--recursive joins?
Posted by Swami at 3/14/2007 10:42:00 AM
I am writing a program to store family tree data, some what similar to the GEDCOM format. I need help writing a sql query to get all the relatives and determine the relation (father's mother, brother's wife, etc) for a particular user. Here is my basic table structure: Table Users -User...more >>

clone a table and its data
Posted by John Grandy at 3/14/2007 10:30:05 AM
Is a system sproc provided to clone a table and its data ? If not, is select into the best way to accomplish this ? ...more >>

Cross Server referencing -- server name is a variable
Posted by sweetpotatop NO[at]SPAM yahoo.com at 3/14/2007 9:20:34 AM
CREATE PROCEDURE sp_getCrossServerData ( @ServerName varchar(50) ) AS SELECT * FROM @ServerName.database.dbo.table GO ...more >>

How best manage database changes when working with multiple developers?
Posted by Ronald S. Cook at 3/14/2007 8:53:11 AM
We have 3 developers incuding myself and want to use VSTDB to version control and manage our database (for an app we are currently designing). Since each developer has a local development instance of the database on our respective machines, what is the best way to manage changes? I.e. I'm us...more >>

add the undo button?
Posted by WebBuilder451 at 3/14/2007 7:28:15 AM
Ok, this is a "What's my problem!!" type question. In SQL Management Studio i'm trying to add the UNDO button to the tool bar. Well, guess what? I can't find it!! -- thanks (as always) some day i''m gona pay this forum back for all the help i''m getting kes...more >>

Sequence of Numbers between two Parameters
Posted by Dream at 3/14/2007 7:04:57 AM
Hi ALL I am trying to build a report that contain a sequence of number so i have make this SP : CREATE PROCEDURE Generate_Sequence ( @First_Num Numeric, @Last_Num Numeric ) AS SET NOCOUNT ON Declare @i as Numeric CREATE TABLE #T (Sequence as Numeric) ...more >>

UDF returning rounded decimals - why?
Posted by Red at 3/14/2007 6:39:30 AM
Hi, I'm new to SQL server, and im just trying out writing a few functions. The following formats a decimal as currency, with currency sign and comma separators. It seems to be rounding the returned values. Any idea why? Thanks, Red. -------------------------------------------------...more >>

How to use Job scheduling in sqlserver 2005
Posted by kannan kannan at 3/14/2007 6:19:23 AM
hi, Can any one tell me a step by step example to create a job schedule and run it using sqlserver 2005. i dont find any sqlserveragent in my sqlserver object explorer.how to enable that and use job scheduling Thanks in advance *** Sent via Developersdex http://www.developersdex.com **...more >>

Disabling all client protocol doesn't affect connection?
Posted by checcouno at 3/14/2007 6:14:08 AM
I disabled all client protocols from SQL Server Configuration Manager - Sql Native Client configuration - Client Protocols. I can open connection also with all client protocols disabled, and in this case all connections use TCP protocol. Why? Thanks!!!...more >>

Dates?
Posted by Mark J at 3/14/2007 5:53:13 AM
Hello, I would like to know how to code a date criteria in sql, i am querying a sql table using microsoft query and have created the following; Date criteria for today date criteria for yesterday date criteria for 2 days ago =getdate() getdate()-1 ...more >>

linked server error trapping
Posted by Craig at 3/14/2007 4:58:08 AM
I am trying to check the status of all linked servers from one sql 2000 server and when I intentionally set a bad password to test failure and then run the query select count(*) from mylinkedserver.master.dbo.sysdatabases I get this error: Server: Msg 18456, Level 14, State 1, Line 1 Login f...more >>

How to get connetcion protocol
Posted by checcouno at 3/14/2007 4:30:13 AM
I need to know the protocol useb by a connection of myDb (TCP ,Named Pipe...). MyDB is SQL Server 2005. Any helps? Thanks!...more >>

Triggers, Auditing, the usual stuff
Posted by Mikey Baby at 3/14/2007 3:25:05 AM
Morning Everyone Imagine I have an SP: CREATE PROC spCreateClient @ClientName, @Address, @CreatedBy (all varchars) Then a trigger on my Client table to make an Audit record on Insert. Seems fine, but how do I capture that @CreatedBy field? Things like SUSER_SNAME() don't help as I'm u...more >>

How do I speed up joins
Posted by aakashdee NO[at]SPAM gmail.com at 3/14/2007 3:08:54 AM
Hi folks, Can anyone suggest me a solution for speeding up queries involving JOINS? Thanx in advance Steve ...more >>

Finding Missing Number between an interval of two numbers
Posted by Dream at 3/14/2007 1:36:34 AM
Hi !! Well this is my first message here and i hope that i will find an answer I have a table T1 that contain an interval of number Exple : Id : 1 , First_Number : 200 , Last number :500 and i have another table T2 that contain sequence of numbers Exple : 200 201 ...more >>

Advice needed: Views, are they good or bad?
Posted by Lim Siew Yin at 3/14/2007 12:00:00 AM
Hi ppl, Since i only have basic knowledge in the world of databases, I need your advice/input on using views (non-updatable, just for reporting purposes) extensively. Is it a normal practise or are views generally a bad thing? My sqls are getting really complicated (having the need to hit > 4 ...more >>

try and catch and XACT_STATE
Posted by JJ at 3/14/2007 12:00:00 AM
If errors occured in the try block, wouldn't it be sufficient to just issue ROLLBACK TRANSACTION in the catch block? Why is following check really necessary? What is the purpose checking XACT_STATE and program accordingly? BEGIN CATCH -- Test XACT_STATE for 0, 1, or -1. -- If 1, t...more >>


DevelopmentNow Blog