Is there a way to select a database from a variable?
Is there a way to select a database from a variable? Declare @bob as varchar(50); Set @bob = 'SweetDB'; GO USE @bob ...
Is there a way to select a database from a variable? Declare @bob as varchar(50); Set @bob = 'SweetDB'; GO USE @bob ...
Is there a way to persist a variable across a go? Declare @bob as varchar(50); Set @bob = 'SweetDB'; GO USE @bob --- see note below GO INSERT INTO @bob.[dbo].[ProjectVersion] ([DB_Name], [Script]) VALUES (@bob,'1.2') See this SO question for the 'USE @bob' line. ...
I have a table that exists in an Oracle database, but doesn't show on my list of tables in the tool SQL Developer. However, if I go to SQL*Plus, and do a select table_name from user_tables; I get the table listed. If I type desc snp_clearinghouse; it shows me the fields. I'd like to get the create statement, because I need to a...
Hi folks, I wish to make a trigger but i'm not sure how to grab the data for whatever caused the trigger. I have a simlpe table. FooId INT PK NOT NULL IDENTITY Name VARCHAR(100) NOT NULL I wish to have a trigger so that when an UPDATE, INSERT or DELETE occurs, i then do the following. Pseduocode IF INSERT Print 'Insert' & Name...
Hi there, I'm having a hard time quoting SQL string properly, I want to know if there's a program or a website that can help me quote the string correctly. Where I can enter the SQL strings then the website will analyze and quote it for me. Or maybe a program.. I need it cause I'm having a trouble with them.. Sorry for not providing a ...
I want to pull data with an MS Access crosstab query so I can bind it to a report. When I load the page I get a Run-time error'3637': Cannot use the crosstab of a non-fixed column as a subquery. I would like a way to get back a fixed grid when I run the query and if the cell is null display a zero. ...
I have to write a deployment script which will work if a stored procedure exists or does not exist. i.e. if it exists, then I need to alter it, otherwise create it. How can I do this in the sql. I am using SQL Server 2005 ...
site_id | start_date | end_date 1 | oct 1, 08 | oct 2, 08 1 | oct 2, 08 | oct 3, 08 ... 1 | oct 30, 08 | oct 31, 08 2 | oct 1, 08 | oct 2, 08 2 | oct 2, 08 | oct 3, 08 ... 2 | oct 30, 08 | oct 31, 08 I have a table that contains 1 record per site per day of the month (per month of the year)...
Best way to store comments flags in a sql db? The comments are posted on a page (mediaId), each comment can have children, comments can be hidden by the person who owns the page or by a moderator. Anyone can flag a comment, but only one category and once. Once a comment has X amount of flags it comes to the moderator attention. If the m...
I have a query which does a number of joins and has a few criteria in the WHERE clause, and I'm ending up with a result which essentially looks like this: | userId | date | otherData | |--------+------------+------------| | 1 | 2008-01-01 | different | | 1 | 2009-01-01 | info | | 1 | 2010-01-01 | for ...
I have the following result set: Type | Method | Amount Type1 Cash Amount Type1 Check Amount Type2 Cash Amount Type2 Check Amount Type3 Cash Amount Type3 Check Amount And I want to make it look like this: Type | Cash | Check Type1 Amount Amount Type2 Amount Amount Type3 Amount Amount How can ...
i hava a table below number 8789789 9080992 3213123 2143123 1312321 ....... ....... 1232123 almost 50.000 rows i want to get ordered numbers like 856620 856621 856622 856623 856624 856625 856626 856627 856628 856629 or 216350 216351 216352 216353 216354 216355 216356 216357 216358 216350 i want to get from table grouping 10 numbe...
This question is similar to my last question. Except this time I'm using letters rather than 6 digit integers. I want to find the out of sequence "letters". Let's say I have the following data: id | Date | Letter ----------------------------- 01 | 5/1/2009 | X 02 | 5/1/2009 | Y 03 | 5/1/2009 | Z 04 | 5/1/2009 | A 05 | 5/1/2009 | B 06 ...
Say for example I've got an SQL schema that is ready to go. How would I import it into my Rails app so that I use my prepared database instead of all those funny migrations. EDIT: You have all misunderstood my question so far. I'm asking if I had a working database application in say PostgresQL. How would I use this as the basis of my R...
I have a database field whose dataType is varBinary. Now in a gridView I want to display that data. But i am getting output: System.Byte[] not the value 0x2C6D1A which is in the database. Please help how to solve this problem. ...
Am Using SQL SERVER - 2000 Table Structure CARDEVENTDATE CARDEVENTTIME CARDNO 20090224 92007 485 20090224 92345 321 20090225 163932 168 20090225 164630 471 20090225 165027 488 20090225 165137 247 20090225 ...
Greetings. I've got a few Word documents that I need to send as notifications when something happens. I've got to fill 10 parameters or so from our SQL Server database. Note that I don't need to send them as word documents, PDF will be fine - I was just given them in .docx form. Now, I immediately thought SSRS was the way to go here....
My SQL skills are rather limited and since I find myself working with a DB (Oracle) a lot lately I would like to get beyond the basic select statements. I want to write queries that do things like get data from multiple tables, sum quantities, compare dates, group, filter etc. What sites can you recommend for getting SQL reporting skil...
Group, I am sure this is user error somehow, but I am trying to CAST a column of numbers from a float to a varchar. It works great for anything under 7 digits, but if the number is 7 digits it turns it into scientific notation or what ever they call that. For example: 440000 displays 440000 1299125 displays 1.29913e+006 It looks like...
I have an order queue that is accessed by multiple order processors through a stored procedure. Each processor passes in a unique ID which is used to lock the next 20 orders for its own use. The stored procedure then returns these records to the order processor to be acted upon. There are cases where multiple processors are able to ret...