sql

Win32 streaming API and the DMZ

We are investigating the use of the Win32 streaming API to pull out files stored with the FILESTREAM capabilities in SQL 08. If a web application, sitting on the public side of the firewall uses the streaming API to pull back a file, what ports must be opened to make this happen? Also, are there any NTFS file/directory permission issue...

Best way to get recent date rows? (this week/month)

I wanna get rows in recent date, this week or month, etc. suppose the table has a field named: product_date. ...

Simple SQL Reporting Services Question

I'm just writing up a feasibility study for a project and before I go in too deep, can I get a .net program to get a list of reports for a server in SQL Reporting Services? In other words, if someone adds a new report, we want it to show in the list. Also, can you get information in detail about the report via some sort of enumeration? ...

SQL in web service best practices

I'm making a stateless web service which uses Microsoft SQL Server to read data (and only to read), without using transactions. What will be the best of the following: Starting SqlConnection at each call to the web service, or Storing SqlConnection in a static field. IMHO, the first approach will cost too much resources (if ten clien...

SQL INSERT INTO returning autoincrement field.

I'm a long time desktop app C++ programmer new to SQL. I need to insert into a table with an autoincrment field, and have that sql statement return the new value for the autoincrement field. Something LIKE: INSERT INTO Entrys ('Name','Description') VALUES ('abc','xyz') SELECT Entrys.EntryID WHERE EntryID=[THE ONE JUST INSERTED!] Sor...

sql server (updating)

if i update one record in table ...after updating how can i ensure that the table has only one affected record. Im using sql server 2005 ...

Compile time Error in ProC (Embedded sql in C)

Please tell me whats wrong with the query. I am using Pro C. EXEC SQL SELECT 1 INTO :db_count FROM sachin t WHERE t.serialno = :serial_no AND t.amount = (:db_inamount - (SELECT NVL(overrun_amount,0) FROM sunny tovrun ...

To get date from datetime in sql

I have datecreated field in a table. It contains value as "2009-12-30 11:47:20:297" I have a query like this: select * from table where DateCreated = getdate() Although one row exists with today's date, I am not getting that row while executing above query. Can anybody help? ...

Best way to dynamically monitor SQL column value in view?

I have a database that has been partitioned into various yyyymmdd aggregated views. There's a column in each of those partitioned views called speed. Is there a way to actively monitor the speed value in the partition view, compared with the previous day's max value and insert into another table if today's speed value is greater than y...

Sql server 2005 acting case sensitive inspite of case insensitive collation

I am having following issue.Even after case insensitive collation. SQL server is treating @Result and @result differently. Am i missing something.Please help. SELECT DATABASEPROPERTYEX('OA_OPTGB_0423', 'Collation') SQLCollation; SQL_Latin1_General_CP1_CI_AS DECLARE @Result varchar(2000) SELECT TOP 1 @result = addr.address_id ...

what's "\." in postgresql dump file?

Hey I have a Postgresql dump file which i'm trying to restore. I get this error regarding an invalid data i guess. ERROR: invalid input syntax for integer: "." and when i checked the file, there are data like this: 469215 2009-10-10 18:16:47.041377 0 1 471217 2009-10-10 18:25:12.536352 0 1 473224 2009-10-17 09:46:43.041...

SQL query minimum maximum

I need to get maximum and minimum values but also I need to get row id of these maximum or minimum on the same row. SELECT MIN([Value]), MAX([Value]), id FROM [AnalystEstimates].[dbo].[AnalystEstimateValues] GROUP BY indicatorid ...

Renaming partitions in ORACLE.

if we use the ALTER TABLE RENAME PARTITION statement to rename the existing partitions in an Oracle table, do we need to recreate the local partitioned indexes with newly changed partition names? ...

are stored procedures faster than functions or not

I am using stored procedures at the moment but I have a lot of stuff like this: if ... begin select 'success' return end if ... begin select 'notgood' return end if ... begin select 'someelse' return end so I'm thinking that it would be a better idea to use functions instead, but is there any performance difference between functions a...

Return array of numbers from my db, use them as a test in another query

I'm struggling with some SQL/php syntax issues here. I'm trying to write two functions. The first will query a database and return an array of numbers that match specific criteria. The second will query a database and use the values from the first function to help select the data I'm looking for. Here's what I have of the first func...

Database Headaches - Mind not working today

I cant seem to get my head around how to create this Each Bold Letter is a Database Table I need this to work with Entity Framework Product [ Product belongs to one group] Product Group - [Computer] [many to many] [Group has many items] [Product belongs to one Group Item] Product Group Item - [Hard Drive] [many to many] [Group Ite...

How to retreive the last row of a table?

How to retreive the last row of a table which doesn't has any unique id like select * from sample where id=(select max(id) from sample) ...

SQL fixed-length insert statement formatter

Lets assume I have this long insert statement insert into table1 (id, name, phone, very_long_col_name, ...) values (1, 'very long name indeed...', '555-555-5555', 1, ...) As you can see above, it gets hard to tell values from their column since their length is uneven I'm looking for something (e.g. command line util) to ...

Query Multiple databases with single ado.net query

I have distributive DB architecture where data is stored in multiple SQL servers. how can i do select/update/delete by running a single query. for example "select * from employees" should return data from all databases i have. How can write single query which run across multiple SQL servers and gets a single consolidated view to my we...

How to format mytext file?

I have to load set of questions to MYSQL database table.But the table format is like below QNO Questions Option a Option b Option c Option d Rightanswer... but my textfile which i need to load in database using LOADINFILE command is in different format. How can i match my textfile format to my table format? ...