|
There's a difference between the installation path, and an install-ID. If I understand you correctly, you're having trouble identifying which of the Sql Server-instances that's on the machine is yours.
Is that correct, so far?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi..thanks a lot...thats exactly correct but before installing i my self should give that value to sql express setup cause that value is static in my project.
|
|
|
|
|
Member 9473809 wrote: thats exactly correct but before installing i my self should give that value to sql express setup
You're explaining what you "want" the software to do, not quite what you're trying to achieve.
One can install Sql Server from the command prompt[^]. That way you could also predefine in which directory the app will be installed.
A word of warning here; you'll be working under the assumptions that you have read/write rights in that location, and that the location exists. Both assumptions would fail on a networked PC here. What's more, most machines already have Sql Server, and it'd be preferable to hook up the database for a new app to one of the existing servers. Your app would fail again if someone moved the database to a different server.
Here's the catch; I'm still wondering why you need to "know" this path. It's defined at install, fine, you could have a custom action in there that writes to the registry where it'll be located. In fact, you can "ask" Sql Server for it's storage- and backup-locations.
What kind of data are you storing in there, and what kind of app are we talking about?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I have read that before but isnt possible to give my own number to MSSQL.x .it creates automatically when wanna install sql.
my main question is how can i give that number my self when wanna install sql express 2005 in command Prompt ?
Thanks in advanced !
|
|
|
|
|
You can't, you can only modify what's mentioned in the article.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
hi sir,
i wanna run setup via command prompt so will you please check that if its possible that to mentian that MSSQL.x in setup custom.
My english isnt well.
thanks in advanced!
|
|
|
|
|
You can use Google Translate to go from English to your language. There are no alternatives to the ones mentioned in the documentation.
Hence, you'll have to find another way to do what you need.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I am trying to run the following code in MySQL without using a procedure or function. I keep getting a syntax error. Does anyone see anything wrong with this code. Am I able to run this code without using a procedure or function.
DECLARE @Machine varchar(30);
SET @Machine = @MachineType;
IF @Machine = 'server'
THEN SELECT COUNT(*) AS 'Total Servers'
FROM agentcomputers AS A
WHERE A.groupid IN('521','637');
ELSEIF @Machine = 'bdr server'
THEN SELECT COUNT(*) AS 'Total BDR Servers'
FROM agentcomputers AS A
WHERE A.groupid =521;
ELSEIF @Machine = 'non-bdr server'
THEN SELECT COUNT(*) AS 'Total Non-BDR Servers'
FROM agentcomputers AS A
WHERE A.groupid =637;
ELSEIF @Machine = 'workstation'
THEN SELECT COUNT(*) AS 'Total Workstations'
FROM agentcomputers AS A
WHERE A.groupid =638;
ELSEIF @Machine = 'laptop'
THEN SELECT COUNT(*) AS 'Total Laptops'
FROM agentcomputers AS A
WHERE A.groupid =650;
ELSEIF @Machine = 'monitored computer'
THEN SELECT COUNT(*) AS 'Total Monitored Computers'
FROM agentcomputers AS A
WHERE A.groupid =1;
ELSEIF @Machine = 'new computer'
THEN SELECT COUNT(*) AS 'Total New Computers'
FROM agentcomputers AS A
WHERE A.groupid =648;
ELSEIF @Machine = 'managed service'
THEN SELECT COUNT(*) AS 'Total Managed Services'
FROM agentcomputers AS A
WHERE A.groupid =522;
ELSEIF @Machine = 'allmachines'
THEN SELECT COUNT(*) AS 'Total Machines'
FROM agentcomputers AS A
WHERE A.groupid IN('1','521','522','637','638','648','650');
/*
THESE IF STATEMENTS RETURN THE COUNTS FOR THE MOBIL DEVICES
*/
ELSEIF @Machine = 'phone'
THEN SELECT COUNT(*) AS 'Total Mobil Phones'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=2;
ELSEIF @Machine = 'tablet'
THEN SELECT COUNT(*) AS 'Total Mobil Tablets'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=3;
ELSEIF @Machine = 'ios'
THEN SELECT COUNT(*) AS 'Total Mobil iOS Devices'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=4;
ELSEIF @Machine = 'android'
THEN SELECT COUNT(*) AS 'Total Mobil Android Devices'
FROM mobiledevices AS M
INNER JOIN mobilemastergroups AS MM
ON MM.groupID = M.deviceType
WHERE M.deviceType=5;
ELSEIF @Machine = 'allmobil'
THEN SELECT COUNT(*) AS 'Total Mobil Devices'
FROM mobiledevices AS M;
END IF;
|
|
|
|
|
SQL Ed wrote: I keep getting a syntax error
On which line?
I suggest you comment out blocks of sql, until you have a working version.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi All
I have merged data into a new table say table1 from table2(need to do this every time data comes into table2..Both the tables have following columns Id,Period(which includes date and time)Constraint(flag is only for table1)
Once the data is merged into table1 the data in table2 gets deleted automatically.when a new data comes into table2 it checks whether the period(only date not the time) in table1 and table2 matches..If it gets matched then we update the constraint flag of table1 to "1". then we add this new data from table2 to table1..Then I should remove the old data...what I wanted to do now is remove the data whose contraint flag is 1 from table1
I have given the code what I have done..Can some one help how to proceed
MERGE INTO table1 AS t1
USING table2 AS t2
ON t1.Id=t2.UsagePointId
WHEN MATCHED THEN
UPDATE SET
AND t1.period=t2.period
t1.constraint=0
WHEN NOT MATCHED THEN
INSERT (Id, period,constraint)
VALUES (t2.Id,t2.period, 0);
WITH x AS
(
SELECT t1.constraint
FROM table1 AS t1
JOIN table2 AS t2
ON t1.Id=t2.Id
AND t1.period =t2.period
)
UPDATE x
SET constraint=1;
WHERE t1.period AS DATE =upi.t2.period AS DATE
|
|
|
|
|
I have the following statment:
SELECT * FROM member_channels WHERE member_channel_address = param_member_channel_address;
that's member_channels where I also have member_channel_id (primary key)
In member_posts, I have member_channel_id..
I want to count total posts linked to member_channel_id and I want to display it as count field in the above statement..
|
|
|
|
|
Something like the following
SELECT *, count(p.member_channel_id) FROM member_channels c, member_posts p
WHERE c.member_channel_address = param_member_channel_address
and c.id = p.member_channel_id
|
|
|
|
|
thanks
but there is one problem.
when member_post has no rows linked to the same member_channel_id, it will not return anything but I want it to return the details with zero count
|
|
|
|
|
|
Can I use something like try/finally construction for guaranteed run script with -b option in sqlcmd? The task is:
turn on single user mode
run some scripts that may be errors
guaranteed turn off single user mode
|
|
|
|
|
Yes, even Sql has the famous try..catch [^] block. Your "finally" would be included at the end of the "try" part.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: Your "finally" would be included at the end of the "try" part.
Whaaaa....? No. Shirley that wont work like a finally block.
|
|
|
|
|
Not guaranteed to execute indeed. Would it help to nest to try's, and check whether an error occured?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: Not guaranteed to execute indeed
Well thats kinda the point of a finally block.
|
|
|
|
|
Hi All,
I have created two databases Test1 and Test2. For one database(Test1) I got the latest version of the code, created the deployement script and deployed the changes to the db.For the other database(Test2) I need to run the deployment script which got created form the Test1 DB.I tried to run the script but my db is not supporting..I get the following errors..
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ':'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ':'.
Msg 50000, Level 16, State 127, Line 4
You cannot deploy this update script to target INP-xx. The database for which this script was built, Test2, does not exist on this server.
Msg 911, Level 16, State 1, Line 1
Database '$(DatabaseName)' does not exist. Make sure that the name is entered correctly.
Can Some one please help me out
modified 27-Sep-12 3:06am.
|
|
|
|
|
sindhuan wrote: Can Some one please help me out
So there are errors for the first four lines of code? Please show us the first four or five lines of code. Otherwise it's hard to help you as we don't know what you do.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
ya..I have given the code below
/*
Deployment script for Test2
*/
GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
SET NUMERIC_ROUNDABORT OFF;
GO
:setvar DatabaseName "Test2"
:setvar DefaultDataPath "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\"
:setvar DefaultLogPath "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\"
GO
:on error exit
GO
USE [master]
GO
IF (DB_ID(N'$(DatabaseName)') IS NOT NULL
AND DATABASEPROPERTYEX(N'$(DatabaseName)','Status') <> N'ONLINE')
BEGIN
RAISERROR(N'The state of the target database, %s, is not set to ONLINE. To deploy to this database, its state must be set to ONLINE.', 16, 127,N'$(DatabaseName)') WITH NOWAIT
RETURN
END
GO
IF NOT EXISTS (SELECT 1 FROM [master].[dbo].[sysdatabases] WHERE [name] = N'$(DatabaseName)')
BEGIN
RAISERROR(N'You cannot deploy this update script to target INP-X. The database for which this script was built,Test2, does not exist on this server.', 16, 127) WITH NOWAIT
RETURN
END
GO
|
|
|
|
|
sindhuan wrote: :setvar DatabaseName "Test2"
Well you are not in SQL-Commandmode, I bet. Change it in the MS Sql Server Management Studio. Go to Query->SQLCMD-Mode
Better way to change (in my opinion):
SET @DatabaseName VARCHAR(32) = 'Test'
...
IF (DB_ID(N'$(@DatabaseName)') IS NOT NULL
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
You need to run this script in SQLCMD mode.
Goto the menu, click Query > SQLCMD Mode
Now you will be able to run your script.
|
|
|
|
|
What am I supposed to do...go to Query->SQLCMD MODE then paste the script and click on execute??
|
|
|
|