Include milliseconds in sql query from C#

I am currently using SqlDataAdapter to query a SQL database: SqlCommand myCommand = new SqlCommand(); myCommand.Connection = myConnection; string cmd = @”select * from dbo.Table where errordate > ‘2015-05-29′”; myConnection.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd, sqlConn); da.Fill(dt); The query is working fine but the only problem is that The date column does not include milliseconds. […]

Invalid Column name for a Temporary table column in a stored procedure

I have a stored procedure inside of which a temporary table is created: I get an error that says: Invalid column name ‘ValFromUser’. Why is that? Why do I get this error only for ValFromuser but no other column?How I may get rid of this? CREATE Procedure [dbo].[OutputProcedure] –declarations here AS BEGIN SET NOCOUNT ON […]

DW Factless Fact Table w/ Transactional Free Form Fields

I am reconstructing a Factless Fact table from a transaction table. There are obvious shared dims like Org, Status, Service, ServiceAction, Send Date, etc. However, There are 2 issues I’m trying to work through: On the Transaction table there are Free Form Entry fields for values like phone, Email, chkbxRequestReceipt. They are all directly related […]

LARGE Parallel insert into SQL server table

We have table with Identity column and it is the clustered index. When trying to insert a large number of rows around 400 Million for running analytics it is taking 2-3 hrs only for inserting. The insert happens from .net application directly where 8 cores write parallelly into the table. we tried few methods trace(610) […]

Creating a custom data type with specific format

I’m moving from an access database to a SQL Server database and wanted to know if I can create my own data type for dates. I want to have my custom date type to have a format of mm/dd/yyyy instead of yyyy/mm/dd. Is this possible to do?

How to convert date so it joins with date dimension table

I have a ProdDate column in Product table that is in the following format: 1/2/2015 1:22:19 PM I need to join this date column to retrieve more information from DimDate table. I am joining with a column name Date that has the following date format: 1900-01-01 00:00:00.000 What I have tried but still doesn’t work: […]

Pulling my hair out at Generic Error Message

I have a dataflow which is a SharePoint List Source to ADO.NET Database Destination . In SSIS 2008, when I run this I get the Error below. I have been through the 40 columns I am bringing through and checked the input size and the size of the database columns and they look fine. Point […]

Sql-server: trigger and last inserted ID

I have a PHP application using a sql-server database and trigger. The workflow is the following: – I create an object in the DB, – a trigger logs the creation into a dedicated table, by inserting a row within, – then from PHP I get the last inserted ID. The problem is that the last […]

Stuck with sql joins

i am a newbie to sql. I have these tables: Table Individual: IndividualId IndividualName Ind1 Mark Ind2 Paul ind3 Spencer ind4 Mike ind5 Hilary Table Agent: AgentId IndId(foreignKey) Agent1 ind1 Agent1 ind2 Agent2 ind1 Agent3 ind4 Transaction Table (Transaction can be made via agent or by individual himself): TranId IndId(foreignKey/Never Null) AgentId(foreignKey) TranAmount Tran1 ind1 […]

How to make a UNIQUE constraint on a Date type column without taking year in regard?

I have a “trips” table with date column (date of trip),but I need not to repeat the day of trip, so I want to know if I could do a unique constraint on a part of the date using sql server 2014. I create this table CREATE TABLE trips ( ID int IDENTITY(1,1) PRIMARY KEY […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.