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

IN or NOT IN?
Posted by james_powers at 6/20/2007 11:47:57 PM
I was trying to debug a stored procedure today, and ran into the following situation: Table MAIL and table APPEALS both contain a column called APPEALCODE. I ran these three queries in Query Analyzer: Select count(*) from Mail --returns 4000000 Select count(*) from Mail where Appealcode I...more >>


query to subtract 2 dates to get no. of days?
Posted by Hassan at 6/20/2007 9:12:30 PM
If i want to get the number of days between 2 dates, how do I do so ? For eg: how many days is it between 5/1/2007 and 6/15/2007 ? Thanks ...more >>

where to put OPTION (MAXRECURSION 100) in an UDF ?
Posted by Sagaert Johan at 6/20/2007 9:03:36 PM
Hi I recoded a stored procedure into an UDF , where do i put the Maxrecusion option ? In my old stored procedure i did put it richt behind the last select, but in the UDF version i get an error.: Incorrect syntax near the keyword OPTION ALTER FUNCTION dbo.GetPartsInDesign ( @designid ...more >>

Notification Services in sqlserver
Posted by Mani at 6/20/2007 8:58:09 PM
Hi All, Do any one know idea about Notification Services in SqlServer 2005. If so, can u plz give some basic information on that. Thanks in Advance ...more >>

Calling non .net dll from a .net dll
Posted by kerry at 6/20/2007 8:04:00 PM
Hi, I have a .net dll that wraps a non .net dll (c++). I need to call the ..net dll from sql, but where do I place the .net dll so it can be accessed ok but the registered assembly? Where do I place it and what are the steps needed? Thank you in advance...more >>

Cannot connect to SQL server over network after update to SP2
Posted by Damir at 6/20/2007 7:21:35 PM
Hello, I'm running MS SQL Server 2005 developer edition on the Windows Server 2003 Small Business Edition. Few days ago I have updated to the SP2 via windows update. Since then I cannot connect to the SQL server remotely (using Management Studio). - If I log remotely to the server box I ...more >>

Calling function
Posted by seema at 6/20/2007 5:28:14 PM
I have the following query and I am calling UDF defined function. But when i runuit it gives me following error message Msg 229, Level 14, State 5, Line 1 EXECUTE permission denied on object 'TimeDifference', database 'twcsan', owner 'dbo'. SELECT tck.tcktreceived, tck.ticketid, tc...more >>

Usage of join
Posted by Raju at 6/20/2007 5:19:00 PM
select a.event, a.customerNo, b.name, count(*) AS theCount from customermembershipallocationsused a join events b on a.event=b.id where customerno='10006' GROUP BY a.event, a.customerNo, b.name will give Event CustomerNo Name Coun...more >>



Query Help
Posted by R C at 6/20/2007 5:17:28 PM
Hi, i have 2 tables. itemFamily table. itemID familyID active deactivateAdvertising table: itemID familyID here's what i need from the query: i want to make sure that when I add a record to the deactivateAdvertising table, i need to check if all the items in the family are present in...more >>

SQL Query Performance Improvement Question
Posted by MattC at 6/20/2007 4:58:23 PM
Hi, I have the following schema: Words ( WordID int identity, Word varchar(20) ) UserWordsLink ( UserID int, WordID int ) I need to insert rows into Words where the Word doenst already exist. Then get the ID for the new and existing words. These along with a U...more >>

Geting count from the data
Posted by Raju at 6/20/2007 4:55:57 PM
select a.event, a.customerNo, b.name from customermembershipallocationsused a join events b on a.event=b.id where customerno='10006' will give Event CustomerNo name 531 10006 Sleeping Beauty 531 10006 Sleeping Beauty 531 10006 Sleeping Beauty 533 10006 Char...more >>

Extracting individual words from a column
Posted by at 6/20/2007 4:07:30 PM
All, I have a column where the data is stored as below: "113";"0";"INV147110";"";"0";"10000" "113";"0";"INV168905";"";"0";"210000" "113";"0";"INV155938";"";"0";"130000" "113";"0";"INV160176";"";"0";"70000" "113";"0";"INV107466";"";"0";"50000" "115";"0";"SCP103759";"";"0";"10000" I'm tr...more >>

CASE statement in WHERE clause
Posted by Mike at 6/20/2007 4:05:20 PM
I need to write a CASE statement which would choose the subquery in the where clause based on an input variable. I would really appreciate your help I am using this in a stored procedure - select code,first name,last name from employee join dept on x=y where column1='some value' and ...more >>

Query returning duplicate values
Posted by Raju at 6/20/2007 3:51:56 PM
When I use join query returns duplicate values such as ID Name CustomerNo NumAllocations 531 Sleeping Beauty 10006 10 531 Sleeping Beauty 10006 20 533 Charlotte's Web 10006 10 533 Charlotte's Web 10006 20 instead of ID Name Custome...more >>

adding column to select statement
Posted by justin at 6/20/2007 3:13:39 PM
I have a table of users and each user can have a manager. I am creating an administrative view for managers where they can see all users, and if they are the manager for that user, I want to show a checkbox that is checked. Is there a way using SQL to add another column to the Select statement...more >>

Browsing
Posted by amerenterprises NO[at]SPAM gmail.com at 6/20/2007 2:56:29 PM
I have a keyed database with some corrupted records (apparently) when i try to do an export - i get an error message at row 66246 "Syntax error converting the varchar value 'P' to a column of data type int. and the export stops. I am exporting to a text file. I tried to bypass it by ignor...more >>

structuring large queries
Posted by codefragment NO[at]SPAM googlemail.com at 6/20/2007 2:27:52 PM
Hi Assume that you have a large query, you want to split it up for performance/readability. Whats the best way to do this and whats the pros/cons of these approaches - temporary tables - subqueries - views Views is probably the area I'm most confused about, reading about seems to suggest...more >>

How to use SQL Server to delete data from MS Access tables
Posted by jrheltmach NO[at]SPAM michaelbest.com at 6/20/2007 1:51:07 PM
Hi all, don't know if I have this in the correct usergroup but here goes. I have a database in MS Access 2003. I also have a DTS package in SQL Server 2000 that takes data from the Access db and updates some tables in SQL Server. What I want to do is, after the package runs successfully, I wa...more >>

ZIP (compression) function(s)
Posted by Dennis Rioux at 6/20/2007 1:40:09 PM
What Microsoft ZIP (compression) function(s) are available to reduce the size of files on a server? The intended files I am trying to compress consist of SQL Server backup files with a .BAK extension. The files are created by the maintenance plan utilization on SQL Server 2000. I would like to...more >>

select statement
Posted by seema at 6/20/2007 1:05:44 PM
Hi, I have the following query. my message field is of datatype text. But I want to grag just first 50 characters + ... from that "message" field. How can I do that. The following is my sql statement select tck.ticketid,tckmsg.message from tbtickets tck inner join tbticketsmessages...more >>

datetime issue 1/1/1900 12:00:00 AM
Posted by ozcan at 6/20/2007 1:05:30 PM
I have an issue with my date fields in sql server 2005… Datatype is : datetime Whenever there is new entry from the application (ASP.NET) and if no date is entered … field gets populated by 1/1/1900 12:00:00 AM Why this happens? If no date is entered … this field should be NULL ...more >>

Server Alias
Posted by Mohammad at 6/20/2007 1:05:02 PM
We are installing a new server X replacing server Y. Many of our OLAP users (over 200) have exported the OLAP reports they frequently refer to, into EXCEL documents on their desk tops, pointing to the database in Y server. We are wondering if there is a way (through creating an alias for ser...more >>

Select statement
Posted by seema at 6/20/2007 1:04:33 PM
Hi, I have the following select statement. for the tcktmessage field I need to grab just first 50 characters + .... . How can I do that in query. select tck.ticketid,tckmsg.tcktmessage from tbtickets tck inner join tbticketsmessages tckmsg on tck.ticketid = tckmsg.ticketid....more >>

how to insert the stored procedures and their code into a table to help track change in them
Posted by mentor.ash NO[at]SPAM gmail.com at 6/20/2007 12:05:51 PM
Hi, I am trying to insert the stored procedures into a table such that the name is in a filed and the whole code is in other field and variables , dependencies and date of change in a separate field. so that the change can be track by going through the table . please suggest me how t...more >>

How to create a user without login in SQL Server 2000
Posted by ded_ly NO[at]SPAM mail.ru at 6/20/2007 11:35:28 AM
Hello. I have the database with 2 users. In SQL Server 2005 there is the option to create a user without the login. But I need to create it in the SQL Server 2000. Please help me with that. Best regards, Dmitry. ...more >>

xp_printstatements
Posted by gracie at 6/20/2007 9:41:06 AM
I would like to use the features of xp_printstatements on a sql 2005 server. The dll that was required in 2000 (xprepl.dll) for xp_printstatements exists in 2005 under y:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\xprepl.dll, however I loaded the proc to the 2005 server: SETUSER...more >>

Most current records based on date & time
Posted by Bill Nguyen at 6/20/2007 9:20:47 AM
Below is my table PT_RackPrice. I would like to run a query that will list the most current record based on Rack_effectiveDate, Rack_effectiveTime ( max(date) & max(time)? ) for each Rack_terminalID, Rack_SupplierID, and Rack_ProductID The resulting dataset should include all the columns in th...more >>

One Large DataSet vs Many Small DataSets
Posted by Irvin McCoy at 6/20/2007 9:02:01 AM
I'm creating a program using MS SQL 2005, VS 2005, and will have around 30 tables. The program will be run on a LAN and on stand alone notebooks with SQL Server Express, it will not be run on Internet or over WAN. I need to know how to create my datasets so that it is fastest for the enduser. ...more >>

Log Shipping with Target Db Triggers
Posted by MarkGsch at 6/20/2007 8:50:00 AM
We need a CDC (changed data capture) solution with a vendor hosting our GL and the vendor does not want to replicate to our local server. Instead, they propose log shipping the GL's database to our local server. I am interested in identifying the data that -changed- in certain tables and wou...more >>

Accessing job schedule information
Posted by Scott at 6/20/2007 7:59:03 AM
Does anyone know where to find job scheduling information. The table sysjobschedules does not provide the job scheduling information i need. It only tells me when the job is going to run next, not the actual schedule information. Where is this information stored....more >>

grant execute rights for the SP
Posted by Xavier at 6/20/2007 7:29:01 AM
Hi, I have a database role APPLICATION_ROLE Is there a possibility to execute a sql command to grant execute rights for on all stored procedures? Manualy I can mark the SP -> Properties -> Permissions->ADD->BROWSE->Mark the role, check Grant execute rights -> OK. But how can I do this o...more >>

sp_help_job
Posted by greg_crawford NO[at]SPAM btopenworld.com at 6/20/2007 7:09:54 AM
Hi, I'm using the SP sp_help_job to get historical data on job runtime etc., When I query all jobs I seem to be getting duplicates. Every job history record is duplicated in the output, apart from maybe a slight 1 second differnce in run-time now and again. the only thing I can think of is Du...more >>

Convert Char to Datetime
Posted by Phil at 6/20/2007 7:05:03 AM
Hi, I am trying to convert a char date value of '18062007' to a date value of 2007-06-18 but not matter what I do it just doesnt seem to work, the script that I am using is like this, the Dataset Due field contains the formatted date 18062007 and is a Char field! select CONVERT(varchar(8...more >>

Inner Join
Posted by Aviad at 6/20/2007 6:50:24 AM
Hi, i have 2 quries: SELECT ([PRODUCTS].[PRODUCTS]) AS [PRODUCTS], ([MEASURES].[SALES AMT]) AS [SALES AMT] FROM (SELECT ([DREK_VIEW].[PRODUCTS]) AS [PRODUCTS] FROM [DREK_VIEW] GROUP BY [DREK_VIEW].[PRODUCTS]) AS [PRODUCTS] INNER JO...more >>

How to create a token in SQL 2005
Posted by Robin9876 at 6/20/2007 6:25:53 AM
In SQL 2005 is it possible to create and validate a security token based on a supplied system (not SQL) user name and password? ...more >>

C# - Need to find instances of SQL Server on client
Posted by Stratum at 6/20/2007 5:01:59 AM
How can I determine using C# which instances of SQL Server 2000, MSDE, 2005 or 2005 Express, if any, are installed on a client computer? For instance, by knowing the computer's name, I could guess at a named instance of the data provider and use it in a connection string, assuming Windows Int...more >>

Scheme by Value
Posted by darkbee at 6/20/2007 2:40:26 AM
Is it possible to Switch scheme by using Value in a select statement Like i have 2 Shemes Sheme Country1 ---------------------- Table - Users ------------------- Field - ID Field - Name Field - Password Field - ConnectedScheme Field - ConnectedUserID Sheme Country2 ----------------...more >>

Best way to recreate a tree structure in SQL
Posted by Leonard Chung at 6/20/2007 1:14:04 AM
I have a tree data structure in a C# app that I need to project into a SQL table. For the sake of discussion, the columns basically look like: int nodeId <node columns for properties> int parentNode The table has a default root node and a foreign key on parentNode to a nodeId. The tree ...more >>

New to cursors
Posted by Mike P at 6/20/2007 1:05:25 AM
I have a situation where I need to insert a new row into a table. A number of the fields to be inserted I already have values for, but there are also a lot of fields that I can only get the value from by looking at a particular field in table 1, getting the key for that row, and then using that...more >>

CTE with variables
Posted by spp at 6/20/2007 12:27:04 AM
I have a SP with a CTE SP has 2 parameters the statement for CTE is ....... WITH rulaj (debit, suma) AS ( select debit, sum(suma) as suma from nc where data between @data1 and @data2 --parameters of SP group by debit ) ........ I receive 'Must declare the scalar variable "@data1"' Can C...more >>

getting nth record from a table without using the primarykey of the table
Posted by ravishankar Maduri at 6/20/2007 12:00:00 AM
can we get the nth record from any table directly wtihout using the primary key of the table . Ravishnakar Maduri ...more >>

I think Ive forgotten what this sql statement is doing!
Posted by Claire at 6/20/2007 12:00:00 AM
I have to produce both sql server and mysql versions of my application and the following sql isnt understood by mysql. The trouble is, I know it produces the result i need but Ive forgotten what the following is actually doing. I wont be able to convert wthout having a full understanding. ...more >>

Dynamic Columns and Results
Posted by Daren Hawes at 6/20/2007 12:00:00 AM
Hi, This is hard to explain so I will try my best for my own sake! I have a website that will compare two or more items. Lets say MP3 players. I need to comapre them side by side. Lets say the phone has the following attributes to compare; Model Size Memory OS Now it would be ea...more >>


DevelopmentNow Blog