Well…don't think I've seen this hack before..I guess you might call it a setbased way to create a numbers table.
Who has done it this way before?
USE [dba] GO
Read more →
…or I guess it could be any platform.. Webcast/Conf Call on Monday…IBM Rep after 3 hours…I piped in… X002548: "ummm, excuse me, so are you saying that XML database models outperforms the relational model?
Read more →
Saw a post the other day on SQLTeam.
The OP Asked: "If I supply a Date, How can I get the next available date, that is not a holiday, and is not on the weekend.
Read more →
Hey there!!!!! In the SQL Server world, if you want to create a database on a same server instance, from an existing database, all you have to do is something like: RESTORE DATABASE <db_name>FROM DISK = '\<file path><file name>'WITH MOVE '<logical data file name>_data' TO '\<file path><file name>.
Read more →
Alrighty Then How to Parse a string in SQl…not always easy…I imagine it really shouldn't have been difficult for M$ to make some T-SQL extensions, but they didn't (or at least up to 2k5…gotta look more into 2k8) Even in REXX we had some nice features…like MASK, WORD, WORDS, etc.
Read more →
Ran across this thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=135575 And figured I'd post this. The code below will generate update statement for all tables that have a char data type. It will then replace a quote (") with an empty sting Guess you could automate this, but this is simple enough.
Read more →
"CAN'T BE DONE" – Crazy boy Well at first glance, that may very well be the answer, as in this thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=100207 Now, this might not be what the OP is looking for, but if you employ a partitioned view, then yes, it's doable cut and paste the sample code to see it in action USE Northwind GO CREATE TABLE myTable99 (Col1 int PRIMARY KEY CHECK (Col1 BETWEEN 1 AND 10), Col2 varchar(50)) CREATE TABLE myTable98 (Col1 int PRIMARY KEY CHECK (Col1 BETWEEN 11 AND 20), Col2 varchar(50)) GO INSERT INTO myTable99(Col1, Col2) SELECT 1, 'x' UNION ALL SELECT 2, 'y' UNION ALL SELECT 3, 'z' INSERT INTO myTable98(Col1, Col2) SELECT 11, 'x' UNION ALL SELECT 12, 'y' UNION ALL SELECT 13, 'z' GO CREATE VIEW myView99 AS SELECT Col1, Col2 FROM myTable99 UNION ALL SELECT Col1, Col2 FROM myTable98 GO SELECT * FROM myView99 UPDATE myView99 SET Col2 = 'x002548' WHERE Col2 = 'z' SELECT * FROM myView99 /* DROP VIEW myView99 DROP TABLE myTable99, myTable98 */
Read more →
....ummm, well, that "line" would be walking through a line in a family tree. I saw a post the other the day that asked, if I know a relative somewhere in a families "lineage", how can I find the entire family tree from top to bottom.
Read more →
EDIT: This is bizzare..I ran multiple table joins, and reran it ovr and over, and the times are always different and one time one is faster than the othe and other times it's the other wway around.
Read more →
"OK Brett, Now that I Removed all my Foreign Keys to Truncate the Data, Now What? I'm Hosed! Thanks a bunch" OK, Well....sorry to keep you hangng out there. But, if you followed the code in the above link you will have all of the RI saved to the work table, so now all you need to do is replay it.
Read more →
I've been asked to assist (this time BEFORE Project initiation for a change) in the developmennt of a new application. The Business Liason/Tech group that is doing this has been collecting requirements (basically reviewing an EXCEL Spreadsheet on steriods) and is coming up with a data model.
Read more →
So, we've gotten into the business of sanitizing or scrambling sensitive production data for development environments. This is, for the most part, was the direction to do this for mainframe flat files.
Read more →
EDIT: As Tara points out:
Vyas did this test quite some time ago: http://vyaskn.tripod.com/differences_between_set_and_select.htm Either I never read it, or I forgot I read it. Well hopefully I pulled some different points together differently here than Vyas did, and at the very least, I hope I made my feeling clear about a program that has to loop over 2 million times.
Read more →
EDIT 2007/09/06: I've modified the sproc to change the dates to be formatted to 121 and stripped out all trailing spaces for char's
So, we don't have DBArtisan, but I am very happy for my copy of ERWin.
Read more →
Why, I still didn't get an answer from the poster in this post. But with Rudy laying the ground work I came up with the following. Why anyone would need to do thids, I have no idea.
Read more →
Well, I did this originally to generate triggers for all tables in a database to audit data changes, and that is simple enough, just move the entire row from the deleted table to a mirrored audit table.
Read more →
EDIT: The script has been repaired and paired down.
Basically this "solution" assigns a derived value to each entity...which I called codex for lack of better term. Each Child inherits their Parents Codex node signature.
Read more →
Like this
SELECT o.name, t.TABLE_NAME, c.text FROM syscomments c JOIN sysobjects o ON c.id = o.id JOIN INFORMATION_SCHEMA.Tables t ON c.text LIKE '%'+t.TABLE_NAME+'%'
Legacy Comments
Peter DeBetta, Microsoft MVP - S
2006-09-22
re: How do I find all the tables referenced by Stored Procedures or Functions Actually, that isn't entirely reliable if the code of the procedure is longer than 8000 characters.
Read more →
Every so often, someone asks, "How do I know who executed a SQL Statement against my database".
Well you can either have SQL Profiler running all the time (which can be very expensive), or you can use Lumingent's Log Explorer.
Read more →
A director came to me asking if a set based approach could be used to find the fallout for trades and receipts. Even though they handed the work off already. The developer used COBOL to compare the 2 file and did "spin-up" processing to match a trade to a receipt.
Read more →