|
-
Prev/Next item with MySQL
Date: 04/19/09
(PHP Development) Keywords: php, mysql, database, sql
[solved, thanks to synergetic]
HiGuys,
Needing a bit of help with MySQL queries. Hopefully someone has the answer, or a pointer at least :)
Say I have a page displaying an item, www.domain.com/item.php?id=12 and at the bottom of that page i want to have a Previous link and a Next link which will link to the previous and next item in the database, how do i call the item numbers? I don't want to just do $id - 1 or +1 becausethe next item might be number 14 for example, not 13.
So before the links are displayed, i need some way of saying the id is 12, look at what the next number is in the id column and select that one. So it's not just a prev/next page link, but prev/next item in the DB link.
Hopefully my laymans terms aren't too confusing!
Any ideas? :)
many thanks,
Paul
Source: http://php-dev.livejournal.com/81861.html
-
php driven image gallery - help needed
Date: 03/10/09
(PHP Development) Keywords: php, mysql, database, sql, web
[solved, thanks to thenetimp]
(x-posted to php)
Hey guys,
I'm coding an image gallery to use on my PHP site and need a bit of help with a couple of features I want to code into it. I was hoping someone here could either give me some pointers or send me to a website that will help with either explainations or code snippets :)
1. Firstly, thumbnails. I have created an admin panel where I upload the images and can set various things like the category, title etc, and all that is stored in a MySql database, and the file uploaded to a general directory. But i'd also like to create a thumbnail of the image as it uploads. I've found several scripts that make thumbnails from images already in a directory, but i'd like it to happen as I upload the image. Is that possible? Without having to use some all-in-one image gallery script heh. I'd also need it to resize the image proportionally so that images aren't just squashed into a 100x100 square shape.
2. Secondly, I'd like to "tag" images like with LJ entries, so that on the front end when a picture is being viewed, the list of tags is shown and can be clicked on to show other image thumbnails with the same tag. But i'm not really sure how to go about this... I was just going to have a table field called img_tags and store them all in that per image, but then is that efficient? searching for matches within a db field? any tips or suggestions?
3. oh and as an extra thought, how can i then take those tags and make a tag cloud maybe?
All and any help would be most appreciated! :)
paul x
Source: http://php-dev.livejournal.com/81475.html
-
Job Posting: Lead PHP developer position
Date: 02/17/07
(PHP Development) Keywords: php, mysql, browser, css, html, database, sql, web, linux, apache
Schedge, an Austin based company, is reinventing scheduling. We are looking for an experienced Lead PHP developer. Have you developed enterprise scale PHP applications? Have you worked with technologies like AJAX and MVC? Then this might be the position for you! You'll be responsible for leading the development efforts of the core application. The position is contract-to-hire with the option of equity in the company. Key Areas of Responsibility: * PHP Application and database development * Work with Designers and other Developers to build complex user interfaces and data interactions * Write/Update functional specs Required Experience: * Enterprise scale PHP experience * MVC (Model-view-controller) design experience * Basic DOM Scripting experience * Basic (X)HTML & CSS experience * MySQL * Multi-browser development * Apache Webserver Preferred additional experience: * Experience with the CakePHP (or similar) PHP framework * Flash or Action Scripting experience * MySQL clustering * Code development for Linux servers You'll be a good fit if: * You “get the Web”, and understand it’s full potential. * Work efficiently and get it right, not just "good enough" * Can set and execute priorities individually and in a group * Effectively communicate to people of varying levels of technical expertise Please note: This is a 100% telecommuting position but the ideal (but not required) candidate would be located in Austin, TX and available for weekly meetings. If you feel you are a good fit for this position please send your resume and rate per hour to jobs@schedge.com
[cross posted] My apologies if you receive this post more then once.
Source: http://php-dev.livejournal.com/75751.html
-
Давайте писать PHP игрушку.
Date: 01/03/07
(PHP Development) Keywords: php, mysql, sql
Ищу людей для создания на общественных началах PHP BBMMOG. Понимаю, что это велосипед, который не гоже изобретать. Но важна не только цель, но и процесс!!!
Приветствуются: графика, вебдезайн, идеи, желание создать свой игровой мир и управлять им. Предполагаемые направления:
- бизнес / финансы
- сельское хозяйство (по мотивам Harvest the moon - от нинтендо)
- околодайвинговая тема
- любые другие направления
Что есть:
- Желание творить
- Хостинг с поддержкой PHP5 и MySql
- Множество идей
- Опыт в ООП, PHP, SQL и т.п.
Можно писать напрямую мне.
Source: http://php-dev.livejournal.com/75394.html
-
free space..
Date: 10/14/05
(Web Hosts) Keywords: sql, web
Free webspace to anyone that knows how to design and wants to build a personal / photographic website.
Just go to the site jenepher.com/x and fill out the form. I will send you your log in information after I set up your FTP account. If you have any questions just email them to me at bratusek@jenepher.com
-20 Mb of space -unlimited bandwidth -no pop ups -no cgi -no sql
Source: http://webhosts.livejournal.com/31628.html
-
Programming Goodness
Date: 10/15/04
(Elite PHP Development) Keywords: php, mysql, database, sql, java
I was lookin around and found this tonight. Very much kewlness, I am hopeing to join in on the fun in the development community so I can add in my ideas to make PHP even better. This is a little bit of information I picked up on Creating Custom Exceptions and sending data to the parent class from a function in a subclass. Very spiffy.
query("SELECT NOW()"); var_dump($result->fetch_row()); } catch(ConnectException $exception) { echo "Connection Error\n"; var_dump($exception->getMessage()); } catch(QueryException $exception) { echo "Query Error\n"; var_dump($exception->getMessage()); } /* Handle exceptions that we weren't expecting */ catch(Exception $exception) { echo "Who was that masked exception?\n"; var_dump($exception->getMessage()); }
$result->close(); $my->close();
?>
very spiffy, and I will be posting something using the new MySQLi class. Maybe a whole class system for the generation of graphics pulled from a database. Possibly attach that to a javascript paint proggy, or even better a flash paint proggy..... hmmm the posibilities are endless, but i have to get back to my money making... Gotta love it, but it would be so much more fun if i had a project that really challenged my knowledge and abilities, but well get to that someday. -=Levi=-
Source: http://php-elite.livejournal.com/504.html
-
Bad clusters on a scsi raid 5 drive.
Date: 04/13/10
(IT Professionals) Keywords: asp, sql, security, microsoft
I should know this.
Checking file system on C: The type of the file system is NTFS.
A disk check has been scheduled. Windows will now check the disk. Cleaning up minor inconsistencies on the drive. Cleaning up 57 unused index entries from index $SII of file 0x9. Cleaning up 57 unused index entries from index $SDH of file 0x9. Cleaning up 57 unused security descriptors. CHKDSK is verifying Usn Journal... Usn Journal verification completed. CHKDSK is verifying file data (stage 4 of 5)... Windows replaced bad clusters in file 87 of name \mssql\MSSQL$~1\Data\DISTRI~1.MDF. Windows replaced bad clusters in file 7220 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\201004~1\TB5CD1~1.BCP. Windows replaced bad clusters in file 26077 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\201004~1\TBLPDF~1.BCP. Windows replaced bad clusters in file 32542 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\201003~1\TB5CD1~1.BCP. Windows replaced bad clusters in file 34123 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\200802~1\TB50D9~1.BCP. Windows replaced bad clusters in file 59114 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\200904~1\TB4CD1~1.BCP. Windows replaced bad clusters in file 66747 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\200904~1\TBLPDF~1.BCP. Windows replaced bad clusters in file 306249 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\200608~1\TB50D9~1.BCP. Windows replaced bad clusters in file 313926 of name \mssql\MSSQL$~1\REPLDATA\unc\INSIGH~1\200608~2\TB50D9~1.BCP. File data verification completed. CHKDSK is verifying free space (stage 5 of 5)... Free space verification is complete. The size specified for the log file is too small.
213371743 KB total disk space. 137811912 KB in 82347 files. 42892 KB in 6088 indexes. 0 KB in bad sectors. 962587 KB in use by the system. 23040 KB occupied by the log file. 74554352 KB available on disk.
4096 bytes in each allocation unit. 53342935 total allocation units on disk. 18638588 allocation units available on disk.
Windows has finished checking your disk. Please wait while your computer restarts.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
~~~~
this is on my domain controller, this is a HP raid5 array consisting of 4 72gb scsi disks. how can you get bad clusters on a raided drive? how can I know which physical drive is failing?
did I actually lose any data/get any data corruption?
I have backups of course, the problem if its hardware failure, and I am going to do migration to windows 2008 r2 from windows 2003, it will still take sometime to initiate things, buying a single replacement scsi might be viable but if I can't identify the drive and have to get 4 scsi drives and rebuild the array 1 disk at the time, it would be problematic not to mention prone to disaster.
Source: https://itprofessionals.livejournal.com/90386.html
-
SQL injection .NET
Date: 03/13/13
(Web Development) Keywords: sql
The pentesters told use that the following code is vulnerable to SQL injection in our e-store:
create procedure dbo.uspBeAfraidBeVeryAfraid ( @p1 varchar(64) ) AS SET NOCOUNT ON declare @sql varchar(512) set @sql = 'select * from ' + @p1 exec(@sql) GO
How I should fix the issue?
Source: https://webdev.livejournal.com/583006.html
-
Converting MS-Access Forms To PHP
Date: 09/26/11
(PHP Community) Keywords: php, database, sql, microsoft
I've got a Microsoft Access application that I'm going to have to convert to PHP and another database (PostGres or SQLite). The db portion I could do by hand if I needed to (the tables are not complicated). It's the forms that I'm worried about.
Does anyone have any experience with a tool for converting Access forms to PHP code? I found DB Convert, which looks promising, but I'd like to know about anyone's first-hand experiences.
Source: https://php.livejournal.com/682814.html
-
Any DBAs in the New York area looking for work?
Date: 07/12/11
(C Sharp) Keywords: sql, web
http://jobsattmp.com/new-york/web-development/dba-sql-server-2005_2008-jobs
Hey all, I am trying to hire a DBA in NYC that has a background in MS SQL Server 2005/2008. If you're interested or know someone who might be please pass their resume along via the link above. Thanks!
Source: https://csharp.livejournal.com/108669.html
-
Bundling changes together.
Date: 02/21/09
(C Sharp) Keywords: cms, database, sql, web
First off, I'll state that I'm working with C# 2008 express edition, SQL Server 2008 Professional edition, and .NET 3.5.
Second, I'll state that one of the ideas behind this project is to do it without .Net's auto-binding. If it can't be done without auto-binding, it's not going to get done at all, for reasons having to do with extreme customization of the data access code that will be happening way, way down the line. So I need an answer in code, not in designer. Thanks.
Okay, what I'm doing seems to me to be simple and obvious, but either .Net doesn't agree with me or I'm looking in the wrong place. I have a simple form. It contains a datagridview and three buttons. One button works perfectly--it's the one that closes the form, and we don't need to discuss it here. The other two buttons, however, are giving me fits. They are labelled "save changes" and "cancel".
The datagridview is bound to a DataTable. This is pretty standard code, I think:
SqlConnection cnErasmus = new SqlConnection();
//populate the datatable with the data already in the table.
tblAuthorType = PopulateDataSet(cnErasmus);
//Attach DataTable to datagrid.
dgvAuthorType.DataSource = tblAuthorType;
(note: it used to be a dataset. I forgot to change the name of the routine.)
In case you want/need to see the actual filling of the DataTable, I'll put it
private DataTable PopulateDataSet(SqlConnection cnErasmus)
{
string strAuthorTypeSelectQuery = "SELECT AuthType FROM AuthorType";
using (cnErasmus)
{
using (SqlCommand cmSelectCommand = new SqlCommand(strAuthorTypeSelectQuery, cnErasmus))
{
CreateConnectionString(cnErasmus);
OpenConnection(cnErasmus);
using (SqlDataReader theReader = cmSelectCommand.ExecuteReader())
{
tblAuthorType.Load(theReader);
CloseConnection(cnErasmus);
}
}
}
All of this is completely normal. At least, I think it is. Now, the tough part seems to be logging changes. The obvious way to do so, to me (I'm a database guy more than a programmer) is through a transaction object:
/******************SqlTransaction trnchangeAuthorTypeData =
cnErasmus.BeginTransaction("Changes");
//Must assign both transaction object and connection
//to Command object for a pending local transaction.
SqlCommand cmTransactionCommand = cnErasmus.CreateCommand();
cmTransactionCommand.Connection = cnErasmus;
cmTransactionCommand.Transaction = trnchangeAuthorTypeData;
//Whether transaction is committed or rolled back depends
//on which button the user presses...********************/
These are the lines just after setting the dgv's data source.
I've seen this done at least a dozen times in various places on the web, but in every case, the example has some sort of hardcoded INSERT or DELETE statement immediately following, and then a try/catch block with the appropriate transaction.Commit() or transaction.Rollback() statements. The important bit for me is that in every example I've found, all the statements follow one another. It's all very procedural. I want the Commit() or Rollback() to be fired based on which of those buttons gets pressed; the Cancel button will cause a Rollback() and the Save button will cause a Commit(). To me, this seems perfectly logical. My problem is that, unfortunately, trnchangeAuthorTypeData goes out of scope the second we hit the end of that block of code, and so is nowhere to be found when I get to btnSave_Click or btnCancel_Click. Setting it the normal way (trnChancgeAuthorTypeData = new SqlTransaction()) raises an error based on the protection level of SqlTransaction, so I can't declare it the way I declare every other variable. (While no resource I've consulted specifically explains this odd behavior, they all confirm that this is by design.)
So, after all that, my question is: how do I separate BeginTransaction(), Commit(), and Rollback() into three separate routines? If that's not possible, as I have spent the last twelve hours ascertaining, is there some way other than transactions to make sure that, when the Cancel button is pressed, the system will roll back all changes since either (a) the form was opened or (b) the Save button was last pressed, and that can be done in that manner (with the transaction-analogue starting in the same routine where the datagridview is bound, and finishing in one of the button-press routines)?
Thanks.
Source: https://csharp.livejournal.com/101781.html
-
Newb question about Struts2 & JSP / Tomcat
Date: 08/01/10
(Apache) Keywords: mysql, database, sql, jsp, web, linux
I'm involved in migrating an existing, functional JSP/Struts2 app from Windows to Linux. The former Windows environment was a Tomcat/Struts/Eclipse setup. The new environment is a standalone installation of Tomcat (which is already configured and serving several other applications). The app in question, "MyJSPWebsite", was copied to the Linux/Tomcat webapps folder and correct permissions assigned. The database (mysql) was also copied over with user permissions established. The site now opens, but none of the struts enabled content is functioning. For example, a drop-down list of data is not being populated. I'm not seeing any error SQL messages in catalina.out, and the username/password & query work fine from command line. Are there separate, core struts files that have to be installed outside of those already included in the webapps/MyJSPWebsite folder?
Source: https://apache.livejournal.com/44268.html
-
"You don't have permission to access.."
Date: 04/25/07
(Apache) Keywords: php, mysql, sql, apache
I'm running Apache 2.2 from wamp (so I have PHP5 and MySQL 5, though I don't think it has anything to do with them) on Windows XP. Anyway.
I can access everything fine using "localhost", and a friend told me that I could access my server by just using my computer's name. So I named my computer "nemo-serv" (all my electrical devices are named after characters from Finding Nemo, my laptop is Nemo,) and then could use nemo-serv fine, just like localhost.
Then I changed something, and I just get a "You don't have permission to access this directory" when using nemo-serv, though localhost is still fine. I really have no idea what I changed that could have done this, but I was hoping you guys would be able to point me in the right direction.
Thanks ^^
Source: https://apache.livejournal.com/36535.html
-
Creating a "SQL Job Launch Shell" for lower-priveleged users
Date: 02/11/13
(SQL Server) Keywords: sql
This is in response to my question on 2/4/2013 for SQL Version 2000 (should work in subsequent versions if you follow my comments)
Design: User Table Created w/ Trigger   CREATE TABLE [dbo].[prod_support_job_queue] ( [job_name] sysname NOT NULL, [step_id] int NOT NULL CONSTRAINT [DF__prod_supp__step___4959E263] DEFAULT (1), [action] nvarchar(6) NOT NULL, (Must be either START, CANCEL, or STOP) [ntlogin] nvarchar(32) NULL, --used to log who made the request [log_date] datetime NULL, [processed] char(1) NOT NULL CONSTRAINT [DF_prod_support_job_queue_processed] DEFAULT ('N') ) ON [PRIMARY]
CREATE TRIGGER [dbo].[ti_job_queue] on [dbo].[prod_support_job_queue] for insert as set nocount on
if ( update(job_name) ) begin declare @username varchar(30) declare @log_date datetime declare @job_name sysname -- Get the user's attributes. select @username = loginame from master..sysprocesses where spid = @@spid
select @log_date = getdate() select @job_name = job_name from inserted update prod_support_job_queue set log_date=@log_date, ntlogin=@username where processed ='N' and job_name=@job_name end
Procedures: - check_job_queue - fires off via scheduled SQL job. It reads from the prod_support_job_queue table
- make_job_request - procedure exposed to the production support team. This helps them insert records into the prod_support_job_queue table
- sp_isJobRunning - (Modified this procedure from THIS publicly available code in order for it to run on SQL 2000 )
Logic:- The user makes his request via the make_job_request stored procedure. He is required to enter a valid job name, action (which is either START, STOP, or CANCEL)
- check_job_queue runs every 10 minutes for check for new actions in the prod_support_job_queue table. It utilizes system stored procedures in msdb to start and stop jobs. For the CANCEL command, a simple update statement is issued to the processed field to exclude it from further processing checks.
- sp_IsJobRunning is called by check_job_queue in order to see if the requested job is already running before issuing any commands
I am adding fine-tuning to the check_job_queue procedure. Once that is done, I'll post the code for the two custom procedures check_job_queue and make_job_request
Source: https://sqlserver.livejournal.com/77452.html
-
SQL Job Administrators - SQL 2008 R2
Date: 02/04/13
(SQL Server) Keywords: asp, sql, microsoft
I'm thinking about doing this because our number of ad-hoc requests to run jobs has increased to an annoying level. Does anyone out there have experience putting this into practice?
How to: Configure a User to Create and Manage SQL Server Agent Jobs (SQL Server Management Studio)http://msdn.microsoft.com/en-us/library/ms187901%28v=sql.105%29.aspx
Source: https://sqlserver.livejournal.com/77287.html
-
Question regarding Collations
Date: 06/08/12
(SQL Server) Keywords: database, sql
Does anyone have any experience on this group in working with Unicode, double-byte case-sensitive data in SQL 2008 R2?
I would like to select a collation for my database that allows case-sensitive sorting/comparisons with Unicode data that could contain Japanese characters. Whew...that's hard to say.
Source: https://sqlserver.livejournal.com/76773.html
-
SQL Server SP2
Date: 02/28/12
(SQL Server) Keywords: sql
Hi, I have multiple instances on SQL Server 2008. We are planning to install SP2 only on one instance. What impact will be for the rest of instances and especially on shared components. Thank you!!!
Source: https://sqlserver.livejournal.com/76475.html
-
Query fun and games
Date: 02/23/12
(SQL Server) Keywords: xml, sql
I've found in general for SQL that there is more than one way to solve (almost) any problem. I've been playing around with query building today and decided to see how many ways I could solve a problem that recurs fairly frequently in my work, flattening subrecords into a single row.
This is my current standard solution, using the PIVOT function. It's quite fast, but limits you to a specific number of subrecords--it can be a high number, but you still have to decide on a maximum.
WITH cte AS (SELECT Person.contactid AS 'ID' , Person.FullName AS 'Name' , 'Activity' = Activity.a422_rel_activityvalueidname , 'Row' = ROW_NUMBER() OVER (PARTITION BY Person.contactid, Person.FullName ORDER BY Activity.a422_rel_activityvalueidname) FROM Contact AS Person INNER JOIN Task AS Activity ON Person.contactid = Activity.regardingobjectid) SELECT ID, Name , 'Activity1' = [1], 'Activity2' = [2], 'Activity3' = [3], 'Activity4' = [4], 'Activity5' = [5] FROM cte PIVOT (MAX(cte.Activity) FOR cte.[Row] IN ([1], [2], [3], [4], [5])) AS pvt
This is a new solution I found in surfing some SQL Server blogs, using FOR XML PATH to create a CSV list of values. It will include an indefinite number of subrecords, but only includes one field from the subrecords. It's significantly slower than the first example by at least an order of ten.
SELECT DISTINCT p.contactid AS 'ID' , p.FullName AS 'Name' , SUBSTRING((SELECT ', ' + Activity.a422_rel_activityvalueidname FROM task AS Activity WHERE Activity.regardingobjectid = p.contactid FOR XML PATH('')), 2, 4000) AS 'Activities' FROM Contact AS p INNER JOIN Task AS t ON p.contactid = t.regardingobjectid ORDER BY p.contactid
This ugly looking creature is what I used to use before PIVOT came along, using many, many multiple self-joins. I'm pretty sure I had a slightly more elegant (and faster!) version of this, but it's been a long time since I've had to create one of these things (fortunately). The performance is...not as bad as you might expect.
SELECT 'ID' = p.contactid, 'Name' = p.fullname , 'Activity1' = a1.a422_rel_activityvalueidname , 'ActivityDate1' = a1.actualend , 'Activity2' = a2.a422_rel_activityvalueidname , 'ActivityDate2' = a2.actualend , 'Activity3' = a3.a422_rel_activityvalueidname , 'ActivityDate3' = a3.actualend , 'Activity4' = a4.a422_rel_activityvalueidname , 'ActivityDate4' = a4.actualend , 'Activity5' = a5.a422_rel_activityvalueidname , 'ActivityDate5' = a5.actualend FROM Contact AS p INNER JOIN Task AS a1 ON p.contactid = a1.regardingobjectid LEFT JOIN Task AS not1 ON p.contactid = not1.regardingobjectid AND not1.activityid < a1.activityid LEFT JOIN Task AS a2 ON p.contactid = a2.regardingobjectid AND a2.activityid > a1.activityid LEFT JOIN Task AS not2 ON p.contactid = not2.regardingobjectid AND not2.activityid > a1.activityid AND not2.activityid < a2.activityid LEFT JOIN Task AS a3 ON p.contactid = a3.regardingobjectid AND a3.activityid > a2.activityid LEFT JOIN Task AS not3 ON p.contactid = not3.regardingobjectid AND not3.activityid > a2.activityid AND not3.activityid < a3.activityid LEFT JOIN Task AS a4 ON p.contactid = a4.regardingobjectid AND a4.activityid > a3.activityid LEFT JOIN Task AS not4 ON p.contactid = not4.regardingobjectid AND not4.activityid > a3.activityid AND not4.activityid < a4.activityid LEFT JOIN Task AS a5 ON p.contactid = a5.regardingobjectid AND a5.activityid > a4.activityid LEFT JOIN Task AS not5 ON p.contactid = not5.regardingobjectid AND not5.activityid > a4.activityid AND not5.activityid < a5.activityid WHERE not1.regardingobjectid Is Null AND not2.regardingobjectid Is Null AND not3.regardingobjectid Is Null AND not4.regardingobjectid Is Null AND not5.regardingobjectid Is Null
Using a recursive CTE almost works, except that for each main record it gives a row with one subrecord, another row with two subrecords, a row with three subrecords, and so on for as many subrecords as are available for that main record. It seems like there has to be a way around that, so if you have any ideas, let me know. Performance is not good, not horrible.
WITH cte AS (SELECT a1.regardingobjectid, a1.activityid , 'Activities' = CONVERT(nvarchar(1000), a1.createdon, 113) FROM Task AS a1 INNER JOIN Contact AS p ON a1.regardingobjectid = p.contactid LEFT JOIN Task AS not1 ON a1.regardingobjectid = not1.regardingobjectid AND a1.activityid > not1.activityid WHERE not1.activityid Is Null UNION ALL SELECT cte.regardingobjectid, a1.activityid , 'Activities' = CONVERT(nvarchar(1000), (cte.Activities + N', ' + CONVERT(nvarchar, a1.createdon, 113))) FROM cte INNER JOIN Task AS a1 ON cte.regardingobjectid = a1.regardingobjectid AND cte.activityid < a1.activityid WHERE NOT EXISTS (SELECT * FROM Task AS not1 WHERE cte.regardingobjectid = not1.regardingobjectid AND not1.activityid > cte.activityid AND not1.activityid < a1.activityid) ) SELECT 'ID' = p.contactid, 'Name' = p.fullname , cte.Activities FROM cte INNER JOIN Contact AS p ON cte.regardingobjectid = p.contactid ORDER BY p.fullname
Creating a custom aggregate function in CLR is another solution, but playing with that will have to be another day.
Source: https://sqlserver.livejournal.com/76055.html
-
Tracking Database Growth
Date: 10/10/11
(SQL Server) Keywords: database, sql
I came across this article when doing some more research on documenting database growth over time. It worked really well for me.
Thank you vyaskn@hotmail.com!
In this article I am going to explain, how to track file growths, especially the database files. First of all, why is it important to track database file growth? Tracking file growth, helps you understand the rate at which your database is growing, so that you can plan ahead for your future storage needs. It is better to plan ahead, instead of running around when you run out of disk space, isn't it? So, how can we track file growths? There are a couple of ways.
The first approach: SQL Server BACKUP and RESTORE commands store the backup, restore history in the msdb database. In this approach, I am going to use the tables backupset and backupfile from msdb to calculate the file growth percentages. Whenever you backup a database the BACKUP command inserts a row in the backupset table and one row each for every file in the backed-up database in the backupfile table, along with the size of each file. I am going to use these file sizes recorded by BACKUP command, compare them with the previous sizes and come up with the percentage of file growth. This approach assumes that you do full database backups periodically, at regular intervals.
Click here to download the procedure sp_track_db_growth. ... **Please use free code responsibly. Test and verify before deploying to production!
Source: https://sqlserver.livejournal.com/75793.html
-
DBA Position Open in North Texas
Date: 07/20/11
(SQL Server) Keywords: technology, database, sql
--------------------------- ------------------------------------------- 1-2 years of total database experience required (preferably Oracle, Sybase, or SQL Server) Experience with Windows Server operating systems Experience with creating SQL scripts and setting up typical database maintenance jobs Experience working with development teams ------------------------------------------------------------------------ The Database Administrator 1 will participate in departmental projects by assisting in the development of project plans, documentation, and performing of project tasks. In support of the other DBA’s, He/She will perform daily maintenance tasks and participate in DBA on-call duty. The DBA I position will be responsible for installing and maintaining database technology in a multi-platform mission critical environment. ------------------------------------------------------------------------ CONTACT: Jennifer Toal Research Analyst COMTEK-Group 972-792-1045 Office 972-467-2901 Mobile 972-644-6602 Fax
Source: https://sqlserver.livejournal.com/75585.html
|