I need to convert int data table field to char leading zeros
example:
1 convert to '001'
867 convert to '000867'
thx.
( This is my response 4 Hours later ... )
I tested this T-SQL Script and work fine for me !
DECLARE @number1 INT, @number2 INT
SET @number1 = 1
SET @number2 = 867
SELECT RIGHT('000' + CAST(@number1 AS NCHAR(3)...
i have a table where i want to track time so a valid entry might be:
1 hour 3 mins
47 mins
10 hours
3 mins 14 seconds
what field type is best used for this. i obviously could use varchar . .but i thought there might be something better as i would like to run queries to total the amount of time over a number of records.
...
nvarchar(max), varchar(max), or should I really decode the string and put it in an image or blob or something?
The longer version : (with all the juicy details)
I've got a .Net SOAP web service, which saves records in a SQL 2008 DB. The service is going to be extended to accept an image, which (for better or worse) also needs to go int...
In MySql I could have a table with an auto increment column and insert that way:
INSERT INTO tbl VALUES(null, "bla", "bla");
Is there any way to do this with Microsoft SQL Server Express?
Instead of this:
INSERT INTO tbl(`v1`, `v2`) VALUES ("bla", "bla");
Thanks
...
Looking for the correct way and control to import and export of out of Microsoft Excel programmatically.
I am willing to get a 3rd party control that supports this functionality, or I can create it myself, but looking to get this prioject done fast.
The Datasource will be offline. Although when it is online for the upload/download if ...
can any one help me, im trying to backup a database located on localhost\SQLEXPRESS but i keep getting the following error
TITLE: Microsoft SQL Server Management Studio
Backup failed for Server 'localhost\SqlExpress'. (Microsoft.SqlServer.SmoExtended)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&P...
i have sql server 2008. i would like to learn the reporting services. where can i start? can you show me a tutorial that helps me make a simple report.
...
Updating an old piece of software but in order to maintain backward compatibility I need to connect to a .mdb (access) database.
I am using the following connection but keep getting an exception, why?
I have validated the path, database existence etc. and that is all correct.
string Server = "localhost";
string...
I have to make a manual calculation of the next run date for a job, can you help me?
...
Maybe I am having a moment of 'afternoon', but can anyone explain why I get
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ')'.
When running
CREATE PROC DisplayDate
(
@DateVar DATETIME
) AS
BEGIN
SELECT @DateVar
END
GO
EXEC DisplayDate GETDATE();
...
I am a powershell novice.
After days of searching....
I have put together a small powershell script (as below) to check page file, /PAE switch, /3GB switch, SQL server max RAM, min RAM.
I am running this on 1 server.
If I want to run it on many servers (from a .txt) file, How can I change it ?
How can I change it to search boot.ini fi...
How do we redirect error/failed data to another table in SQL Server, during data importing in SSIS 2008 ?
...
Table1
ID | WorkTime
-----------------
001 | 10:50:00
001 | 00:00:00
002 | ....
WorkTime Datatype is *varchar(.
SELECT ID,
CONVERT(varchar(10), TotalSeconds1 / 3600) + ':' + RIGHT('00' + CONVERT(varchar(2), (TotalSeconds1 - TotalSeconds1 / 3600 * 3600) / 60), 2) + ':' + RIGHT('00' + CONVERT(varchar(2), TotalSeconds1 - (T...
Is there any way to convert differential backup to SQL statements which will produce identical results when applied?
Or any other solution similar to binary log in MySQL?
...
Is there any open source software for converting SQL statements to LINQ?
...
Has anybody managed to get the ".NET Data Provider for SqlServer" to actually work within perfmon.exe.
I have a .NET app that uses nhibernate to interact with sql server 2005 db. All I want to do is to view the NumberOfActiveConnectionPools, NumberOfActiveConnections and the NumberOfFreeConnections within perfmon.exe
Can somebody expl...
Is there a tool that will convert MS Access SQL to T-SQL?
...
Hi,
I'm trying to use sub-domains in my ASP.NET website but I'm coming across a few problems with the session being reset.
I've edited my hosts file to have 'localhost', 'one.localhost' and 'two.localhost'. I can go to any of these URLs and do what I need to do and login to my system. The session mode is defined as follows in the web.c...
Our application needs a simple scheduling mechanism - we can schedule only one visit per room for the same time interval (but one visit can be using one or more rooms). Using SQL Server 2005, sample procedure could look like this:
CREATE PROCEDURE CreateVisit
@start datetime, @end datetime, @roomID int
AS
BEGIN
DECLARE @isFreeRoom I...
Hi, I am trying to write a bash or PHP script that will execute a procedure on a MS-SQL server, does anybody have pointers on how to do that in the most easiest and convenient way?
The script will run on a separate Linux box.
Thanks.
...