sql

Export Data Definition Script from an Oracle Database

I am new at working with oracle, my only experience is in sql server. In SQL server you can right click a table and say export create script. I need that for Oracle, specifically 10g. Is there a way via GUI or sql command that can accomplish this? ...

Using the Groovy Sql object

I'm trying to do some basic queries using the groovy.sql.Sql object, and I'm getting a SQLException that I can't seem to diagnose or make go away. I've reduced it to the simplest case, and I'm still seeing the problem. My code: import groovy.sql.Sql def bodyText def sql = Sql.newInstance("jdbc:oracle:thin:@192.168.X.Y:1521:hostname",...

Can't connect remotely to database on SQL Server 2005

Hey Guys, I am new to managing servers but I have just been given full access to set up an MS SQL Database on win server 2003. I have created a Database successfully and can connect locally (via remote desktop server) Problem is I can't connect to the database from my personal computer (remotely, via ms sql server management studio). I...

MDF file size much larger than actual data

For some reason my MDF file is 154gigs, however, I only loaded 7 gigs worth of data from flat files. Why is the MDF file so much larger than the actual source data? More info: Only a few tables with ~25 million rows. No large varchar fields (biggest is 300, most are less than varchar(50). Not very wide tables < 20 columns. Also, no...

Do table aliases make complex queries harder or easier to read?

Possible Duplicate: SQL Table Aliases - Good or Bad? I've been maintaining and extending a somewhat convoluted multi-website application in PHP for nearly two years now. Whilst some major pieces have been upgraded or re-written, there are still huge swathes that haven't been touched since before I started. Many of the previous...

MySql If statements

I have a simple table that logs simple events an administrator does. Nothing complicated. One of the columns is userid, so I can reference the user's name from the users table: SELECT u.username FROM `users` u, `history` h WHERE u.userid = h.userid My issue is that the internal system also logs events (just like a user), but there i...

transfer subscription reporting service

Hi, Would you recommend the best and easy way to transfer (or copy) the subscriptions from one reporting service to another reporting service in different server? ...

MySql with more then one Column

I have this table ------------------ 1 | 20,00 | A | 2 | 20,00 | A | 3 | 20,00 | A | 4 | 20,00 | A | 1 | 50,00 | B | 2 | 50,00 | B | 3 | 50,00 | B | 4 | 50,00 | B | I wold like to produce this one using group by. id | A | B | ---------------------- 1 | 20,00 | 50,00 | 2 | 20,00 | 50,00 | 3 | 20,00 ...

select count(*) vs keep a counter

Assuming indexes are put in place, and absolute-count-accuracy is not necessary (it's okay to be off by one or two), is it okay to use: Option A select count(*) from Table where Property = @Property vs Option B update PropertyCounters SET PropertyCount = PropertyCount + 1 where Property = @Property then doing: select ...

INSERT - PHP & SQL Server

I don't know what is going on, but it just doesn't want to work. I keep getting this error when I submit my form: Array ( [0] => Array ( [0] => 22001 [SQLSTATE] => 22001 [1] => 8152 [code] => 8152 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]String or binary data would be truncated. [message] => [Microsoft][SQL Serve...

SQLite string contains other string query

How do I do this? For example, if my column is "cats,dogs,birds" and I want to get any rows where column contains cats? ...

PHP & MS SQL - Foreach Loop?

Hi All, I have a table in my ms sql database and am using PHP. What I am trying to do is: Foreach User in table, get his age and favorite color. And for each entry i want to edit it before it is displayed. For example Each User that is retrieved and displayed on the webpage will be hyperlinked. His/her age will be hyperlinked and the ...

mysql query for timezone conversion

hi, is there a way to convert from unix timestamp to GMT in mysql while running the query itself?? My query is as follows: SELECT r.name , r.network , r.namestring , i.name , i.description , r.rid , i.id , d.unixtime // this is the unix time i am asking to print , d.ifInOctets FROM range AS r INNER JO...

SQL Server 2005 - removing table triggers?

How can I remove all triggers from my tables. I have many tables, but about 20 of them have triggers and I want to remove them all. ...

export multiple (same) dbs and import into one automatically

I need to write a program or script which a client can run to do the following. I have an application which runs offline on multiple computers which is exactly the same but the data will differ. Let's call this SourceDB. Therefore, there is SourceDB1, SourceDB2, and SourceDB3. Then there is a server which hosts the main application whic...

Get list of MySQL databases, and server version?

My connection string for MySQL is: "Server=localhost;User ID=root;Password=123;pooling=yes;charset=utf8;DataBase=.;" My questions are : What query should I write to get database names that exist? What query should I write to get server version? I have error because of my connection string ends with DataBase=. What should I write in...

please correct me with the sql query

Whats wrong wrong with this query please correct me on this syntactcally it's going wrong please correct me on this how to concatenate this string cmd = "SELECT * FROM [tbl_students] WHERE course_id=@courseId AND branch_id IN ("+branchId+") AND (@passoutYear is null...

Oracle SQL syntax between Standard/enterprise and Express

I have a question in different Oracle versions. In their download page, there is Standard/Enterprise, and there is Express. Other than performance and other infrastructure tools, do the two different versions support the same set of SQL script keywords? For example, if I generate DDL tables from standard, is there a chance it may not wor...

Cant read .bak files.

I wanted to read .bak files that are the backup files of my ms sql database.Now I am wodering how to read these files using Sql Mngmnt studio. Please help me out .Thanks ...

sql query error

Possible Duplicate: please correct me with the sql query giving error mentioned below y so please correct me on this Msg 137, Level 15, State 2, Line 1 Must declare the scalar variable "@courseId". @"SELECT * FROM [tbl_students] WHERE course_id=@courseId AND branch_id IN("+branchId+@") AND (@passoutYear is n...