How do I fix 'Invalid character value for cast specification' on a date column in flat file?

I have a CSV file with a {LF} delimiting each row and a date column with the date format as “12/20/2010” (including quotation marks) My destination column is a SQL Server 2008 database table of type date (not datetime) In my Flat File Connection Manager, I have configured the date column to be data type […]

Cannot connect to remote SQL server

A client of mine gave me a server name which is fully qualified [servername] to try to connect to their SQL Server instance over VPN. So I tried, using the username and password they gave me. No luck. I can ping it but cannot connect, I get the error that the username and password is […]

Select rows where price didn't change

Suppose you have a table like (am using SQL Server 2008, no audit log – table is HUGE): SecID | Date | Price 1 1/1/11 10 1 1/2/11 10 1 1/3/11 5 1 1/4/11 10 1 1/5/11 10 Suppose this table is HUGE (millions of rows for different secIDs and Date) – I would like […]

Pulling facebook and twitter status updates into a SQL database via Coldfusion Page

I’d like to set up a coldfusion page that will pull the status updates from my own facebook account and twitter accounts and put them in a SQL database along with their timestamps. Whenever I run this page it should only grab information after the most recent time stamp it already has within the database. […]

“Incorrect syntax near 'OFFSET'” modift sql comm 2012 to 2008

I’m listing questions with this SELECT q.qTitle, q.qDescription, q.qCreatedOn, u.uCode, u.uFullname, qcat.qcatTitle, q.qId, q.qStatus FROM tblQuestion AS q INNER JOIN tblUser AS u ON q.uId = u.uId INNER JOIN tblQuestionCategory AS qcat ON q.qcatId = qcat.qcatId WHERE (q.qStatus = 1) ORDER BY q.qCreatedOn DESC OFFSET @page*10 ROWS FETCH NEXT 10 ROWS ONLY But there is […]

Error: “Must declare the scalar variable” for insert statements in multiple database

I created a SQL script to add an entry in different database. However, when I run the script through SQL Server Management Studio. declare @address varchar(50) set @address = ‘Hope’ use DB1 go insert into Address values (@address) go use DB2 go insert into Address values (@address) go I got the following error: Must declare […]

SQL Server: How to find all localdb instance names

I have two versions (2012, 2014) of SQL Server Express LocalDB installed in my system. How can I find all existing LocalDB instance names? I found a way to do that using command line as mentioned in the answers section. Is there a better and easy way to do it?

SqlBulkCopy performance

I am working to increase the performance of bulk loads; 100’s of millions of records + daily. I moved this over to use the IDatareader interface in lieu of the data tables and did get a noticeable performance boost (500,000 more records a minute). The current setup is: A custom cached reader to parse the […]

In SQL Server, how to move/import a multiple .trc files to a trace table

I have a set of rollover .trc files recorded with Sql Profiler. mytrace.trc mytrace_1.trc mytrace_2.trc mytrace_3.trc I can import the first one using this command: use [my-database] SELECT * INTO trace_folder FROM::fn_trace_gettable(‘C:\mytrace.trc’, 4) However, this only appears to load the first file, not all four.

Insert into multiple tables

A brief explanation on the relevant domain part: A Category is composed of four data: Gender (Male/Female) Age Division (Mighty Mite to Master) Belt Color (White to Black) Weight Division (Rooster to Heavy) So, Male Adult Black Rooster forms one category. Some combinations may not exist, such as mighty mite black belt. An Athlete fights […]

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