sql

How do I create an odbcparameter for a sql server xml datatype for an odbccommand object?

So I've got a situation where I need to pass a bunch of data to the server to create a bunch of records. So I read this article and chose the XML method. So I've got the stored procedure all created in sql server 2005. But now I need to call it from asp.net code. Only all I've got for a database connection is an odbcconnection. I se...

getting row count in db2 using system tables ?

howdy! I can get row count from system table in db2 using select tabname,card from syscat.tables where tabname='?' but this will give static row count,If I need to get dynamic one I need to run runstats on the table. is there any other way apart from using count(*) ? Cheers, Prateek ...

Prevent users from creating Schedules for jobs

Guys, I need to restrict the development users from creating new schedules for SQL Agent jobs. They should be able to create a job and pick one of the available schedules, but should not be able to create a new schedule. I have a bunch of developers creating SSIS packages that need to be scheduled off business hours. I am now faced wit...

Do SQL connections opened with PDO in PHP have to be closed

When I open a MySQL connection in PHP with just PHP's built-in MySQL functions, I do the following: $link = mysql_connect($servername,$username,$password); mysql_select_db($dbname); //queries etc. mysql_close($link); When I open a connection with PDO, it looks like this: $link = new PDO("mysql:dbname=$dbname;host=$servername",$userna...

xslt/xml byte array, to a image

I am getting back a image from SQL server as a byte[]. Can I use xsl transform to convert it into an actual image for a webpage? How, may I do so if this is possible? ...

Database Programming Concepts

So I've read a couple books on SQL and I've used SQL and created databases, but really nothing advanced, a couple tables, a couple joins, that sort of thing. So now I am working on a project that is pretty big. The database is going to have multiple tables and we will be processing 40'000 to 80'000 rows of data daily. Now I find myself...

Cross platform datastore for storing application data?

Our application currently stores bunch of configuraton & application specific data to files on disk. Configuration data is stored in a single .ini file where as application data is distributed across multiple files. The application has grown now and data manipulation using files is becoming a nightmare. We would like to make a switch to ...

Getting rid of "Magic" numbers in SQL Server

In code one can specify globally accessible constants/enums/etc once that can then be reused through out the application. This gives the ability to use meaningful names like 'Mazda' instead of numbers like '2'. We would like to do the same with in our SQL Server stored procedures, but are not sure of the best way of implementing this. ...

What are the major differences between Sql Server 2005 and Sql Server 2008?

Duplicate Advantages of MS SQL Server 2008 over MS SQL Server 2005? What are the major differences between Sql Server 2005 and Sql Server 2008? How could I convince my organization to invest in Sql Server 2008? For me, one major aspect that I see is that they have a good framework to programmatically generate SSIS packages with the us...

Performance of MS Access when JOINing from linked tables in different servers?

If I have an MS Access database with linked tables from two different database servers (say one table from an SQL Server db and one from an Oracle db) and I write a query which JOINs those two tables, how will Access (or the Jet engine, I guess?) handle this query? Will it issue some SELECTs on each table first to get the fields I'm JOIN...

Can I use the the power of Generics to solve my issue

I have a wierd issue. I am loading 1k invoice objects, header first then details in my DAL. I am using VB.NET on this project. I am able to get the invoice headers just fine. When I get to loading the details for each invoice I am getting a timeout on SQL Server. I increased the timeout to 5 minutes but still the same thing. If I reduce ...

How to import excel files into SqlDatabase .mdf file

I have one long excel sheet with books details of a library..can i import this data into a .mdf file. ...

How do I get revolving last 12 months in T-SQL 2005?

At the moment I use DATEPART(yy, MY_DATE) = DATEPART(yy, GETDATE()) to get Year-To-Date details and have to convert it into the revolving last 12 months. How would I do that? ...

optimising a query

i have a table in database that is having 7k plus records. I have a query that searches for a particular id in that table.(id is auto-incremented) query is like this-> select id,date_time from table order by date_time DESC; this query will do all search on that 7k + data.......isn't there anyways with which i can optimize this query ...

New to SQL, need help with query

Hello all; I have a database table of my own that I am trying to construct a query for that seems simple enough, but I feel like I am messing up somewhere because the results are not what they should be. I basically have a table that is like the following: Table: Data Columns: Row ID Profile Import ID Field ID...

Why do I get a duplicate key error and what is this unique index []$[]$[]$ ?

When I tried to commit a sql query I ended up with the following message: cannot insert duplicate key row in object [] with unique index '[]$[]$[]$' What does that mean? and what "'[]$[]$[]$'" is composed of? ...

T-SQL Grouping rows from the MAX length columns in different rows (?)

Hello, i'm trying to come up with a way to combine rows in a table based on the longest string in any of the rows based on a row key example CREATE TABLE test1 (akey int not null , text1 varchar(50) NULL, text2 varchar(50) NULL, text3 varchar(50) NULL ) INSERT INTO test1 VALUES ( 1,'Winchester Road','crawley',NU...

DateTimeOffset.Now in T-SQL

I'm executing a INSERT to a sql 2008 db. How do I specify in T-SQL to insert NOW in a DATETIMEOFFSET column? GETDATE()? ...

How to precompile stored procedures in SQL server?

Hi, Good morning ! Is there any way to pre compile stored procedures in SQL Server? My requirement goes like this.. I have some stored procedures, which take more time in compiling than executing. So I want to precompile all the stored procedures. It would be nice to precompile them when the db server is started and running. Any id...

Index for multiple columns in ActiveRecord

In ActiveRecord there are two ways to declare indexes for multiple columns: add_index :classifications, [:species, :family, :trivial_names] add_index :classifications, :species add_index :classifications, :family add_index :classifications, :trivial_names Is there any difference between the first approach and the second one? If so, wh...