sql-server-2008

how to get time (hh:mm:ss) from sql query ?

hi i have Database with date field. i see the time like: 1900-01-01 13:38:00.000 how i can see it like: 13:38 ? (i work on sql server 2008) thank's in advance ...

How to parameterize database connection string in ssis package

Hi all, I have a SSIS package built in Business Intellegience Development Studio which have both source and destination database specified. Now I want to use some variables to parameterize the database connections and run the package in a command line. I try to replace the database name and sql server instance with my variable @[User::...

How do I connect to a SQL Server 2008 database in Java with JDBC?

I have MSSQL 2008 installed on my local PC, and my Java application needs to connect to a MSSQL database. I am a new to MSSQL and I would like get some help on creating user login for my Java application and getting connection via JDBC. So far I tried to create a user login for my app and used following connection string, but I doesn't w...

Date ranges intersections..

MS Sql 2008: I have 3 tables: meters, transformers (Ti) and voltage transformers (Tu) ParentId MeterId BegDate EndDate 10 100 '20050101' '20060101' ParentId TiId BegDate EndDate 10 210 '20050201' '20050501' 10 220 '20050801' '20051001' ParentId TuId BegDate EndDat...

Point of sale app architecture advice

hi everyone! I need to develop a point of sale app that will be used on several locations. In every location it will be use a single database and it will be, in another location a master database with all cashflow and inventory moves. The restriction is that the available internet connection between nodes is very poor, so in certain way ...

Refreshing metadata on user functions t-SQL

I am doing some T-SQL programming and I have some Views defines on my database. The data model is still changing these days and I have some table functions defined. Sometimes i deliberately use select * from MYVIEW in such a table function to return all columns. If the view changes (or table) the function crashes and I need to recomp...

View temporary table`s data when debugging an MS SQL Function

I'm currently debugging an Ms SQL Function (SQL 2008). In this function, I have a variable declared this way: DECLARE @TempTable TABLE ( Id INT UNIQUE ); Then, I insert some records using an insert into...select statement. When debugging, I would like to see the records in this table. Is there a way to do this? Thanks ...

Can you authenticate into SSAS with AD LDS (ADAM) accounts?

I'm very new to AD LDS and experienced but not qualified with SSAS, so my apologies for my ignorances with these. We have a couple implementations where we expose SSAS via an HTTPS proxy (msmdpump.dll) and currently we have a temporary domain setup handling this (where our end-users have a second account+creds to manage because of this ...

Reliable test for MSDTC promoting transactions to distributed?

How can I reliably check that MSDTC has promoted a transaction to a distributed transaction? This is when using TransactionScope in .net. Currently a co-worker is testing this by shutting down the coordinator on his machine - if an exception is thrown this is taken as evidence that an attempt to promote the transaction has occurred. Is...

Faster way to transfer table data from linked server

After much fiddling, I've managed to install the right ODBC driver and have successfully created a linked server on SQL Server 2008, by which I can access my PostgreSQL db from SQL server. I'm copying all of the data from some of the tables in the PgSQL DB into SQL Server using merge statements that take the following form: with mbRem...

Need a good way to store data in a DB from a table on a webpage that can have N columns.

Users need to be able to add a specific type of column to an otherwise static table on my web page and then save the information they enter in there to the database. I've been told that in reality they will almost never go over 5 columns but I would rather support N. The columns will all be of the same datatype. My first thought was t...

Where should the partitioning column go in the primary key on SQL Server?

Using SQL Server 2005 and 2008. I've got a potentially very large table (potentially hundreds of millions of rows) consisting of the following columns: CREATE TABLE ( date SMALLDATETIME, id BIGINT, value FLOAT ) which is being partitioned on column date in daily partitions. The question then is should the primary key be ...

Database copy between servers - user logins corrupted

When I copy a database from one server to another via backup and restore, I find I have to recreate the users in the database. I can't login as them right after the copy - I get cannot open default database, when the database that was just copied is the default database. Why is this? The logins exist on the target copy server. ...

Concatenation of fields in different rows

I'm stuck on an aggregation problem that I can't get to the bottom of. I have some data which is best summarized as follows id |phraseId|seqNum|word ========================= 1 |1 |1 |hello 2 |1 |2 |world 3 |2 |1 |black 4 |2 |2 |and 5 |2 |3 |white I'd like a query that gives back...

Using Domain Administrator account for SQL Server

Is it wise to use Domain Administrator as a SQL Windows Authentication log-in? ...

Getting stored procedure's return value with iBatis.NET

How can I retrieve the return value of a stored procedure using iBatis.NET? The below code successfully calls the stored procedure, but the QueryForObject<int> call returns 0. SqlMap <procedure id="MyProc" parameterMap="MyProcParameters" resultClass="int"> MyProc </procedure> <parameterMap id="MyProcParameters"> <parameter pr...

Search between dates and times in SQL Server 2008

I need to search between dates and times. For example, between date: 30/02/2007, time: 10:32 and date: 21/06/2008, time: 14:19 What is the most simple query for this? Thanks in advance. ...

SSIS Inserts 0 as a value in an identity column

Hi, we have this problem : in sqlserver 2005/2008 we create some new tables with an integer identity column as the primary key : [Id] [int] IDENTITY(1,1) NOT NULL. When loading data in this table via an SSIS dataflow task, SSIS should automatically fill the Id column. It does, BUT it starts at 0 in stead of 1. After that, when we delete...

What to consider if using triggers on tables in a sql-server merge replication

Hi, i am driving since some years a sql-server2000 merge-replication over three locations. Triggers do a lot of work in this database. i got no troubles. Now migrating these database to a brand new sql2008, i got some issues about the triggers. They are firing even if the merge-agent does his work. Is there anybody who has some experi...

pass username and password to get-credential or run sql query without using invoke-sqlcmd in Powershell

I am trying to connect to a remote sql database and simply run the "select @@servername" query in Powershell. I'm trying to do this without using integrated security. I've been struggling with "get-credential" and "invoke-sqlcmd", only to find (I think), that you can't pass the password from "get-credential" to another Powershell cmdle...