not sure on any of the actual coding but could you dateadd -1 day from the first of the following month to give you the last day of the month and assign the last day (day(variable)) to a variable (eg. lastday).
then assign a vairable as 1 (eg. curday)
then do a for loop
for curday to lastday...
Can do this in ASP but i'm struggling to get my head round it here
i want to select from a table if code = 101 (easy)
just two things, how do i refer to fields within a selected record. (it may seem simple but its different to me)
if theres more than one record that match how can i cycle...
Ok, i see where you're coming from here.
I'm thinking two tables,
ie.
table 1
code, description, notes (these being the info i need)
table 2
code, next_code
this way i can have
table 1
100, enter data
101, check data
102, check email
103, etc etc etc
table 2
100, 101
100, 102
so when 100 is...
Unfortunately we have purchased a system, and my job is currently to write that system to do what we need, I have thought about the structure and extra tables, but i cannot change anything major in theirs and I can't change their GUI to view my tables.
Also although there are generally the same...
I have a table that i have all pending tasks held in, there are many different stages with the innitial setup of a client record so there are many triggers on this pending table.
It is already becoming quite a lengthy trigger,
lots of
if CODE = 100
insert this pending for run
if CODE = 101...
Thats brilliant cheers, i'm used to using VBscript statements in ASP, never even touched on @@RowCount before (i have a lot to learn).
Thanks Dave
Theres nothing worse than an idea when its the only one we have!
...know in SQL how to say not in table, ie.
if code = 124 had been confirmed (deleted) then i want it to check for code 125 in the table
select * from TABLE where code = 125
if 125 exists i don't want it to do anything, if it doesn't then run insert statements.
The if statements and insert...
Thankyou,
Found them myself about 5 minutes ago by clicking around, boy is my face red!!!
Cheers for the help. Dave
Theres nothing worse than an idea when its the only one we have!
Hi,
as my recent posts may suggest i'm just trying to get to grips with t-sql and i'm trying my hand at most sections.
I am currently trying to get Sql to check my database once a month and setup new pending records accordingly.
I've created my stored procedure, I even managed to schedule my...
Sorry my bad,
What you told me was kind of whet i needed to know, i've just been informed by someone else exactly what i need to do and i've picked that out from your code too (now i know what i need to be looking for in your code, as i said, its all new to me!)
Basically the bit i needed was...
Before you have <%Language=VBScript%> at the top try
<%
response.write "<script LANGUAGE=""JavaScript"">nam1 = """ & nam & """</script>"
%>
This should define the variable in javascript and insert the value of nam into it.
My last...
I need to create many triggers on a table each checking for different things (or i could whack them in one...) but I need to call the same procedure from many tables for many different reasons with only minimal data differences.
Such as we have many status's of records,
If a record ref BI has...
Check you event viewer and see if theres some kind of relevant message to do with SQL in there.
The only time i've had this problem is when i hadn't registered my server correctly! Dave
Theres nothing worse than an idea when its the only one we have!
The only way i know this is to response.write it all to the screen.
response.write "<script language=""JavaScript"">"
response.write "ID1=BobForm.usrNam.value;"
response.write "if(ID1 != """ & nam & """)"...
Newbie to programming within t-sql but i'm slowly understanding it.
My problem
We are using an external piece of software but (with permission) are deveoping the back end to work more with our needs.
When a new contact record is entered into a table I want it to check for a few things and on...
Cheers, I kind of have something working....
Done what you said, i can pull info through with different criteria and stuff, still not sure how to set this to be date based, and I'm still playing with statements to try and update stuff.
Still haven't got the big picture as to how to run and...
Right, i know it can be done now, my only problem is I'm struggling to piece together a stored procedure, i need to walk before i can run i think.
Really really sorry, I just need an initial push then i think i should be cool.
All examples of stored procedures seem way complex, is there an...
A little out of my league.....
I want to write a trigger / stored procedure to run on a pre defined day of the month (ie. the first), every month.
I want it to run only once a month checking information from a sales table and setting up records to a pending table if my criteria is matched...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.