all groups > sql server programming > june 2006 > threads for monday june 26
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
Enumerating jobs on a SQL server using SMO - in C#
Posted by SQLguythere at 6/26/2006 11:02:01 PM
Hi all, I'm trying to connect to SQL and enumerate all Agent jobs to find a
particular and call job.envoke on it.
Looked every where but can't find a code snippet on it or a sample.
Anyone can assist? Cheers
... more >>
Populating a jagged array from a SQL database table
Posted by onecorp at 6/26/2006 8:51:01 PM
Scenario one:
I have a variety of sql tables. The number of columns varys from 27 to 59.
The columns headings are numbers, commencing with 1 and incremented by 1.
(and the rows are dates)
The data in the columns is either 1 or null .
I have built a simplistic stored procedure that 'pair... more >>
Fully qualified name of a table
Posted by Robert Bravery at 6/26/2006 8:31:53 PM
Hi all,
How can I find the fully qualified name of a table, if all I have is the
table name
I realise that this might be a bit ambigious, but I was wondering.
For example, if I had a table name like employees. It could be in northwind,
or in corporate or both
is there a way to find this out
... more >>
auto number via a query
Posted by Jake Smythe at 6/26/2006 8:29:38 PM
Hello,
I am wondering if somone could provide me with a sample SELECT for an
auto number query. For example I have a table called People with two columns
first_name, and last_name. There isn't a unique id to correspond with the
table but would like to dynamically make one during the ret... more >>
Need Kick in right direction w/query take 2
Posted by Lucas Graf at 6/26/2006 8:14:17 PM
Bumping this up to the top, scroll down a bit to see the original thread.
---
I have updated the DDL with the actual tables and a sample of table data of
what I am actually using.
http://damageinc.org/DDL.html (The DDL is too large to post, the message
gets kicked back to me)
AFter you e... more >>
Master database
Posted by Robert Bravery at 6/26/2006 8:13:35 PM
HI all,
Learning MSSQL.
What makes the SP tables etc in the master database available to all
databases in the current session of MSSQL server
Thanks
Robert
... more >>
Alternate ways of deleting records - without logging
Posted by Andrei at 6/26/2006 6:00:57 PM
Hi Group,
I'm looking for an alternate solution to delete rows from a temporary table.
Now, when the users run reports, the data belonging to each user is stored
in a temporary table, having an userid attached to each row.
Before starting a new report, the program issues a delete command li... more >>
AFTER TRIGGER
Posted by Yan at 6/26/2006 5:58:35 PM
I would like to create a trigger that after a DML event, let's say an
INSERT, will call an external exe file using xp_cmdshell and pass to the exe
the @@identity which resulted by the INSERT.
Is there a way to achieve this?
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Conditional join?
Posted by Blasting Cap at 6/26/2006 4:36:25 PM
I have a dropdown box in a .net app that I am populating from a couple
tables.
One is a salesrep table, with the sales rep code and a name in it.
The other table is a table with a sold to sales rep code and a ship to
sales rep code - which may not always be the same in both these columns. ... more >>
Help for joining tables (2nd try ;o) )
Posted by Henry at 6/26/2006 4:18:44 PM
Okay so I'll give it another try
I have an assigment design a web solution with a presention of energy
consumptions from some appartments.
All appartments are identical and have 5 meters, the only difference is the
appartment number (3 digits) e.g. "105" all meters gets logged once every
... more >>
TSQL RETURN / OUTPUT
Posted by Jon Vaughan at 6/26/2006 4:07:28 PM
DECLARE @X FLOAT
EXEC @X = GetArchievedTableValueNoStaff 9006, 1
PRINT @X
Returns 21, but when I use this within my tsql like :
DECLARE @TableSales FLOAT
SET @TableSales = 1
exec @TableSales = dbo.GetArchievedTableValueNoStaff @Table_ArchiveID,
@DepartmentID
PRINT TableSales... more >>
Group By Error Under SQL 2005
Posted by StevenBr at 6/26/2006 4:04:02 PM
Our stored procedure throws the following error when running on 2005
w/compatibility set to 90, but not 80:
"Each GROUP BY expression must contain at least one column that is not an
outer reference. Severity 15, State 1, Procedure "procname", line 351"
The code in question is:
......
... more >>
min or max over multiple columns
Posted by maarten_dtg at 6/26/2006 3:14:29 PM
Hi all,
A short question about min and max functions. Let's say I have the following
table:
contract sales_2005 sales_2006
1234 100 120
5678 870 560
Now, I want to build a query that gives the following result:
contract maximum_sa... more >>
xp_sendmail - Concantenation
Posted by Bret at 6/26/2006 2:51:02 PM
Please,
the below xp_sendmail & FETCH code works wonderfully.
However I've modified the @message variable to include a variable indicating
the amount of records the end user needs to approve but it fails. I've tried
everything I could like creating a message string in a variable and feeding
... more >>
Updating a Text Field using Dynamic SQL
Posted by Mike Collins at 6/26/2006 2:44:01 PM
I am trying to update a text field using dynamic sql, but am getting the
following error: Invalid operator for data type. Operator equals add, type
equals text.
How can I update a text field using dynamic sql. I do not know what field is
being updated ahead of time.
sql statement from my... more >>
Temp Tables or Views in SP
Posted by ricky at 6/26/2006 2:42:17 PM
Hi
I'm sure this is far too much of an ambiguous question, but is it better to
use #tables, in an sp to bring back additional data in a table join, or is
it better to create views and join them in the SP?
Kind Regards
Ricky
... more >>
DECLARE SYNTAX
Posted by harpalshergill NO[at]SPAM gmail.com at 6/26/2006 2:33:13 PM
I am trying to convert a declare syntax from SQL to MySQL
the syntax is as follows:
declare @x int ;
set @x = (SELECT max(ixBugEvent) FROM bugevent) ;
UPDATE bugevent
SET ixAttachment = (SELECT max(ixAttachment) FROM attachment),
ixBug = (SELECT max(ixBug) FROM bug)
WHERE ix... more >>
Job Scheduling
Posted by Maria at 6/26/2006 2:04:02 PM
How do I schedule the jobs to run in sequence? I have created a package to
call the sql server agent jobs in sequence but looks like all the jobs are
running at the same time, not waiting for the other jobs to complete. I did
put the constriants not to run the second job until the first job is... more >>
stored procedure to text file
Posted by d4 at 6/26/2006 2:03:05 PM
I have a stored procedure that pulls from several tables and does a
PRINT to generate a report. I can save the report thru Query Analyzer
as a Text file, but would like this to be done automatically either in
the SP or maybe a DTS package.
Any examples/suggestions would be appreciated...
... more >>
Problem with Update query
Posted by Mark at 6/26/2006 1:56:36 PM
Hi - I have 2 tables, which I would like to 'merge'.
tblAccess and tblCars
tblAccess:
a_id int (identity)
a_user (varchar50)
a_pass (varchar20)
a_cid (bigint)
tblCars:
c_id (identity)
c_user (varchar50)
c_carname (varchar50)
These were joined using the a_cid to c_id field, but... more >>
Programmatic access to Enabled Protocols in SQL2005?
Posted by Mark Findlay at 6/26/2006 1:42:05 PM
My C++ program is able to read the "Enabled Protocols" for SQL2005 by
reading the registry at:
HKLM\Software\Microsoft\Microsoft SQL Server\<instance
name>\MSSQLServer\SuperSocketLib\<protocol alias> and then reading the
"Enabled" value to see if it is enabled or not.
This works fine fo... more >>
Default value does not get written
Posted by Bob at 6/26/2006 1:19:21 PM
I have a CreatedOn field , datetime, which has GetDate() as the default
value. When I create a new record in the table itself, the field gets
populated OK, but when I try to create a new record with a Microsoft
datagridview control, I notice that the datecreated value does not get
created. I... more >>
Iterating through a recordset
Posted by ryankbrown NO[at]SPAM gmail.com at 6/26/2006 1:18:52 PM
I am a newly indoctrinated SQL Server 2005 user. So, forgive me if this
question is amatuer.
I am trying to create a stored proc that will read in a list of values
from one table (Possibly using a cte?) then iterate through each record
running another sp to populate a temp table and return all m... more >>
Have Insert statement, need equivalent Update.
Posted by rhaazy at 6/26/2006 12:46:58 PM
Using ms sql 2000
I have 2 tables.
I have a table which has information regarding a computer scan. Each
record in this table has a column called MAC which is the unique ID for
each Scan. The table in question holds the various scan results of
every scan from different computers. I have an in... more >>
creating payperiod table
Posted by Bill Nguyen at 6/26/2006 12:46:33 PM
I need to either add to the famous "Calendar" table a column called
"hourlyPayPeriod" or to create table payPeriod
pay interval = 14 days.
For 2006:
pay period#1:
beginPeriodDate = 12/25/2005
endPeriodDate = 1/7/2006
(hence payperiodID = 2006-01)
this shoudl allow computation of subsequen... more >>
SELECT statement help
Posted by schoultzy at 6/26/2006 12:35:05 PM
Hello everyone,
I am working with the following code:
select section_master.trm_cde, section_master.crs_cde, crs_title,
crs_capacity,
crs_enrollment, section_master.udef_3a_1, monday, tuesday, wednesday,
thursday, friday, begin_time, end_time, bldg_cde, room_cde,
name_master.last_name
f... more >>
Calling vb script from SQL job
Posted by Derekman at 6/26/2006 12:12:03 PM
I am trying to execute a visual basic script using a SQL job. I can schedule
this as a scheduled task and then use a separate SQL job to compelte the
formatting tasks, but prefer to keep all steps consolidated so it is easier
to trouble shoot.
I tried using xp_cmdshell 'job.vbs', no_output... more >>
sql 2005 stored procedure
Posted by John at 6/26/2006 12:12:02 PM
Is xp_sqlagent_proxy_account still a valid stored procedure in sql 2005?... more >>
Unnecessary Joins Question
Posted by Mark at 6/26/2006 11:44:02 AM
Hello,
I have a question that has been nagging me for some time. I have a large
database where several parts have JOINs to what would be the equivalent of a
drop-down list in the user interface (e.g. a list of types). The (types)
table only has a TypeDescID field (PK, identity) with a Typ... more >>
DBCC SQLPERF(SpinLockStats)
Posted by Paul Sinclair at 6/26/2006 11:34:05 AM
Does anyone know of a good resource for explaining
DBCC SQLPERF(SpinLockStats)?
Mostly I'm wondering what each entry is actually measuring and how that
information can be applied for profiling a system?... more >>
Going after repeat offenders in SP
Posted by _Stephen at 6/26/2006 11:13:05 AM
Issue is a batch processing SP that does multiple inserts (6 tables)
This statement contains a "repeat offending" NOT IN ( ) clause.
-- start code
SELECT
@BatchID, MA.Merchant_Account_ID, 0, 0, @Batch_Date, 0, 0
FROM Merchant_Account MA
WHERE Merchant_Account_ID NOT IN (SELECT El_Accoun... more >>
SQL 2000 - Link to a table in another SQL 2000 DB
Posted by Kevin111 at 6/26/2006 10:42:54 AM
I need to know if it is possible to link to a SQL 2000 DB table from a
different SQL 2000 DB table? We can address the different servers as
part 2 of this question, if possible.
Please provide an example or detailed explanation of how to code the
link (in SQL 2000 Enterprise Manager?).
Tha... more >>
Simple query question...
Posted by news.valornet.com at 6/26/2006 10:36:00 AM
Hi,
I am using:
select itemid,count(itemid) as cnt from icitemunits group by itemid
Which will show me the count of records with the same itemid. It is when I
add:
select itemid,count(itemid) as cnt from icitemunits where cnt>1 group by
itemid
I get the message:
Msg 207, Level... more >>
Connect to specific TCP/IP endpoint?
Posted by KJ at 6/26/2006 9:45:29 AM
Hello All,
I'd read in BOL that it is possible to connect "explicitly" to a
specific TCP/IP endpoint on the server. Does anyone know how to do
this? I can't find an example anywhere.
Thanks in advance.
-KJ
... more >>
SQL Server 2000 - UDF for Encryption
Posted by Tony_VBACoder at 6/26/2006 9:11:03 AM
Does anyone have a good UDF for Encryption/Decryption? I thought about using
an example I found for TEA
(http://www.codeproject.com/netcf/teaencryption.asp), but am not a huge SQL
Server programmer. I would need this function to be called when I write a
simple SELECT SQL statement on such ... more >>
Can both SQL Management Studio (2005) and SQL Enterprise Management (2000) coexist in 1 desktop/server?
Posted by Bill Nguyen at 6/26/2006 8:46:32 AM
I need to manage both 2000 and 2005 SQLservers. Is it possible to install
SQL Enterprise admin (2000) on my desktop (which already has 2005
installed)? IF it is, how?
Thanks a million
Bill
... more >>
text searching in stored procedures
Posted by TLuebke at 6/26/2006 8:37:01 AM
Is there a way to easily search through all stored procedures looking for a
particuler text string (i.e. dsn name?)... more >>
Format Date
Posted by birdbyte NO[at]SPAM gmail.com at 6/26/2006 8:30:25 AM
I have a stored procedure that selects several fields from a table,
including a date field. I'd like to format the date field in the stored
proc so that the result reads mmddyy or mmddyyyy - without any slashes
or dashes, and without the time (06/26/2006 06:53:06.373 would read
06262006). Any id... more >>
Dates for previous week
Posted by wxbuff NO[at]SPAM aol.com at 6/26/2006 8:01:37 AM
Good morning all -
I need to run a report against the previous full week... for example,
today the report should run for dates from 6-18-2006 to 6-24-2006.
I have found code that will tell me the previous Saturday and could
just subtract 7 days from that, but I am wondering if there isn't so... more >>
EM - connect to correct server
Posted by Sandy at 6/26/2006 7:14:02 AM
Hello -
I can connect to other servers through QA with no problem, however, when I
try to access another server through Enterprise Manager, I cannot find where
I can change the server. It is defaulting to my local machine.
Can someone tell me how to do this?
Any help is greatly apprec... more >>
Is this a bug in MSSQL (2000) (Invalid delete statement)?
Posted by Van at 6/26/2006 6:34:02 AM
create 2 tables:
USE TEMPDB
GO
CREATE TABLE TEST1 (ID INT)
GO
CREATE TABLE TEST2 (BLA INT)
GO
--Load some data
INSERT INTO TEST1(1)
INSERT INTO TEST1(2)
INSERT INTO TEST1(3)
INSERT INTO TEST2(1)
GO
-- The following statement raises an exception
SELECT ID FROM TEST2 WHERE BLA = 1
GO
... more >>
Renaming linked tables
Posted by TLuebke at 6/26/2006 5:35:01 AM
We link to an Oracle DB from a SQL2000 box. The System Admins on the Oracle
side are going to rename all their tables. Is there a way to rename linked
tables from the new name back to the old. (i.e. Access has a right
click/rename function) something that will buy us time until we can get our ... more >>
Extract Data from XML Column
Posted by Malkesh at 6/26/2006 4:23:02 AM
Hi,
I've table named Item which is having one column "State".
"State" column is of data type XML and in which some
scheduleing Information is stored with some other element.
Data is looks like,
---
<item> <scheduling>
<enabled>True</enabled>
<schedule name="Custom Schedule">
<Trigg... more >>
Convert datetime to char/nvarchar or the opposite (in specific for
Posted by Niron kag at 6/26/2006 1:26:01 AM
I have a table with a column name Tdate, data type datetime, and length 8.
The look of the existing data in this column is from this format
DD/MM/YYYY HH: MI: SS.
I want to pass to a stored procedure string and another data that will
update a specific row, where the string I pass is equal to t... more >>
How2 make a DDL
Posted by henry at 6/26/2006 12:00:00 AM
Does anyone have a link or something?
regards
Henry
... more >>
Performance: Use MS SQL DB to write logs ?
Posted by LTDEV at 6/26/2006 12:00:00 AM
Hi,
Im considering using a MS SQL database for storing logs from a set of
serverapplications - today im writing loginformation in ordinary files, but
since i need to do some statistics and want to perform some events when some
conditions are met in the log (and ofcourse the flexibility that... more >>
|