Our accounting department wants to be able to run a report showing the next six months of rent payments due:
Bldg 12/2012 01/2013 02/2013 03/2013 04/2013 05/2013
101 2000 2100 2100 2100 2100 2100
102 50100 50200 50300 50400 50500 50600
(and so on)
The rent schedules are stored in the RENTSCHED table:
BLDG RENT STARTDATE ENDDATE
101 2000 2012-01-01 00:00:00.000 2012-12-31 00:00:00.000
101 2100 2013-01-01 00:00:00.000 2013-06-30 00:00:00.000
101 2200 2013-07-01 00:00:00.000 2013-12-31 00:00:00.000
102 50000 2012-11-01 00:00:00.000 2012-11-30 00:00:00.000
102 50100 2012-12-01 00:00:00.000 2012-12-31 00:00:00.000
102 50200 2013-01-01 00:00:00.000 2013-01-31 00:00:00.000
102 50300 2013-02-01 00:00:00.000 2013-02-28 00:00:00.000
102 50400 2013-03-01 00:00:00.000 2013-03-31 00:00:00.000
102 50500 2013-04-01 00:00:00.000 2013-04-30 00:00:00.000
102 50600 2013-05-01 00:00:00.000 2013-05-31 00:00:00.000
102 50700 2013-06-01 00:00:00.000 2013-06-30 00:00:00.000
(and so on)
Although I can get the 6 months' rent for any single building (e.g. 102) ...
DECLARE @BLDG char(12)
,@nextMo DATETIME, @mo2 DATETIME, @mo3 DATETIME
,@mo4 DATETIME, @mo5 DATETIME, @mo6 DATETIME
,@nextMoRent FLOAT, @mo2Rent FLOAT, @mo3Rent FLOAT
,@mo4Rent FLOAT, @mo5Rent FLOAT, @mo6Rent FLOAT
SELECT @BLDG='102'
,@nextMo=DATEADD(MONTH, DATEDIFF(MONTH, 0, getdate()) + 1, 0)
,@mo2=DATEADD(MONTH, DATEDIFF(MONTH, 0, getdate()) + 2, 0)
,@mo3=DATEADD(MONTH, DATEDIFF(MONTH, 0, getdate()) + 3, 0)
,@mo4=DATEADD(MONTH, DATEDIFF(MONTH, 0, getdate()) + 4, 0)
,@mo5=DATEADD(MONTH, DATEDIFF(MONTH, 0, getdate()) + 5, 0)
,@mo6=DATEADD(MONTH, DATEDIFF(MONTH, 0, getdate()) + 6, 0)
SELECT @nextMoRent = [RENT]
FROM [RENTSCHED]
where [STARTDATE] < @nextMo AND @nextMo < [ENDDATE] and [BLDG]=@BLDG
SELECT @mo2Rent = [RENT]
FROM [RENTSCHED]
where [STARTDATE] < @mo2 AND @mo2 < [ENDDATE] and [BLDG]=@BLDG
SELECT @mo3Rent = [RENT]
FROM [RENTSCHED]
where [STARTDATE] < @mo3 AND @mo3 < [ENDDATE] and [BLDG]=@BLDG
SELECT @mo4Rent = [RENT]
FROM [RENTSCHED]
where [STARTDATE] < @mo4 AND @mo4 < [ENDDATE] and [BLDG]=@BLDG
SELECT @mo5Rent = [RENT]
FROM [RENTSCHED]
where [STARTDATE] < @mo5 AND @mo5 < [ENDDATE] and [BLDG]=@BLDG
SELECT @mo6Rent = [RENT]
FROM [RENTSCHED]
where [STARTDATE] < @mo6 AND @mo6 < [ENDDATE] and [BLDG]=@BLDG
SELECT @BLDG, @nextMoRent, @mo2Rent, @mo3Rent, @mo4Rent, @mo5Rent, @mo6Rent
... I have been unable to find a way to get it for **all** buildings at once.
Any help is greatly appreciated.
↧
Please help: How to report next 6 months' rent
↧
How to found objects in rebuild maintainance plane?
We have a rebuild maintainance plane for around 40 selected tables... So how to get the list of those selected tables which are scheduled rebuild maintainance plane?
↧
↧
How to reduce LDF file size and give back free space to OS
Hi, i have 120 GB LDF file size and 23 GB MDF file size,please give me better solution, how do i reduce or clearup those space and provide back to Operating System for its normal Performance.
↧
Sql Query Help
Hi Everyone,
--Please find the attached script for table creation and table values
I have the table like below
cno cname phonenumber type
1 AAA 1234 P
1 AAA 3456 W
1 AAA 3456 H
2 BBB 5678 W
2 BBB 7894 H
3 CCC 1111 P
3 CCC 2222 H
4 DDD 8888 H
I need to get the result like below[link text][1]
cno cname phone
1 AAA 1234
2 BBB 5678
3 CCC 1111
4 DDD 8888
Here,I want to display phonenumber of customer
If type is primary display primarynumber
and if doesn't display work number otherwise display the home phonenumber
[1]: /storage/temp/497-customer.txt
↧
Replication error of Non logged agent shutdown error how to resolve this error?
hi we are using snapshot replication in SQL agents, we are using SQL 2005. but we have receive below error on replication.
i am new to this so any one suggest me what kind of error is this? and how to resolve.
i checked checkident on table it is also correct. so cant able to point the error.
i bolded the keyword of some error for easy anlyse of readers.
orginal error is see below:
> Date,Source,Severity,Step ID,Server,Job Name,Step Name,Notifications,Message,Duration,Sql Severity,Sql Message ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted
11/03/2012 06:15:25,LIVEDBNAME Copy to SourceDB,Error,0,liveservername,dbnamelive Copy to destinationdb,(Job outcome),,The job failed. The Job was invoked by User akumar. The last step to run was step 3 (**Detect nonlogged agent shutdown**.). The job was requested to start at step 1 (Distribution Agent startup message.).,00:00:26,0,0,CSC_Operators,,,0
11/03/2012 06:15:51,LIVEDBNAME Copy to SourceDB,Unknown,3,liveservername,dbnamelive Copy to destinationdb,Detect nonlogged agent shutdown.,,Executed as user: NT AUTHORITY\SYSTEM. The step succeeded.,00:00:00,0,0,,,,0
11/03/2012 06:15:25,LIVEDBNAME Copy to SourceDB,Error,2,liveservername,dbnamelives Copy to destinationdb,Run agent.,,The replication agent encountered a failure. See the previous job step history message or Replication Monitor for more information. The step failed.,00:00:26,0,0,,,,0
11/03/2012 06:15:25,LIVEDBNAME Copy to SourceDB,Unknown,2,liveservername,dbnamelive Copy to destinationdb,Run agent.,,2012-12-03 11:15:51.186 Category:NULLSource: Microsoft SQL Native ClientNumber: Message: Batch send failed2012-12-03 11:15:51.186 Category:NULLSource: Microsoft SQL Native ClientNumber: 2627Message: **Violation of PRIMARY KEY constraint 'PK_tablename**'. **Cannot insert duplicate key in object 'dbo.tablenamee**'.2012-12-03 11:15:51.202 Category:NULLSource: Microsoft SQL Native ClientNumber: 20253Message: To obtain an error file with details on the errors encountered when initializing the subscribing table execute the bcp command that appears below. Consult the BOL for more information on the bcp utility and its supported options.2012-12-03 11:15:51.202 Category:NULLSource: Number: 20253Message: bcp "db"."dbo"."tablename" in "\\liveservername\ReplData\unc\**liveservername_dbname_dbname SNAPSHOT TO otherserver\20121201020034\tablename_13#6.bcp**" -e "errorfile" -t"\n\n" -r"\n<@g>\n" -m10000 -Sdestinationdb -T -w,00:00:26,0,0,,,,0
***finally what is non logged agent shutdown means????***
Note: I replicace source db and destination db, server with original name for security purpose
furthur i have gave the snapshot from replication monitor for understand.........plz help meeeeeee............![alt text][1]
[1]: /storage/temp/506-non+logged+agent+shutdown+error+on+replication.jpg
**can i Reinitialization MS SQL Replication Subscirber may fix the issue?**
↧
↧
cpu usage high by Sqlserver? how to become normal??
HI I am a Junior DBA
we are using SQL Server 2005, In our Server
32 GB of RAM
CPU Processor EM64T Family 6 model 15 stepping 6 Genuineintel-1995 mhz
windows server 2003 R2
**But last week we faced CPU usage very high by SQL SERVER.**
see the figure below;
Fig 1:
![alt text][1]
Fig 2:
![alt text][2]
I have checked for any long running queries/Transaction checked in day by day basis.
but recently no long running quries are taken place then
**why CPU process reaches 100% frequently?
which steps to follow CPU become normal state or not using SQL SERVER more resource???**
[1]: /storage/temp/509-sql+process+high.jpg
[2]: /storage/temp/510-cpu+usage+high.jpg
↧
Can we upgrade sql server 2005 to sql server 2012?
hello All,
I need experts advised who have already started to work on sql serevr 2012, i came across an article in MSDN stating that "90 compatibility level and upgrade from version 90 (SQL Server 2005 Database Engine" is DEPRECATED and "Compatibility levels are only available for the last two versions." At my work we have Sql Server 2k5 and we are planning to go to sql server 2012 soon, does that mean i need to upgrade it to 2008 or 2008R2 and the 2012? how shall we do it? any idea guys...?
Thanks,
↧
How to shrink data file in small sizes?
I have data file with 52GB and it have free space of 5GB ... After I ran dbcc shrinkfile('databfilename',0)... It is taking long time to shrink (about 7min) and still running so I stopped it....
So please let me know how to shrink small sizes relaseing 500MB space ang again 500MB space... May be it could be speed up?
↧
is it possible to track who removed the sysadmin role to particular user?
hi
I am using SQL SERVER 2005,We have 5 sysadmin role users are working in MY organization include me.
I have a userid login credentials sysadmin role privileges in SQL Server.
But My problem is **every week some one removed the Sysadmin privileges from My userid
login. then I asked my management to get back the sysadmin privileges in my login.**
Repeatedly, Every Week I faced this problem someone removed MY Sysadmin privileges in
SQL Server and I asked for management to get back.
So
**1) Is it possible for Track or See which user is removed sysadmin privileges on My login????**
**2)what user and what type of privileges he removed corresponding to that user?**
see the figure for Before and After:
Before:
![alt text][1]
After:
![alt text][2]
[1]: /storage/temp/523-login+before.jpg
[2]: /storage/temp/524-login+after.jpg
↧
↧
how to trace last apporach to a table of a database
Hi all, i have an issue to a specific table of a database, Explanation: 1.somebody updated the complete records of a table from the past entries, for finding that i tried to collect the details from database Restore History but i couldn't find any trace on that,it make sure they not done database restore, they may dropped table or recreated or only deleted entries and inserted new entries.
what i want exactly, what exact action made by whom and what to that specific table of a database on what exact time?
Note:(SQL SERVER 2005)OEM table currently having 9516 entries like around 7 months data , but Server table having 111257 entries for the same duration of time, am pretty dam sure server side fetch and store data don't have any mistake bcoz logic is build so strong
please! help me some one.
↧
accessing returned values of table-valued UDF
Hi All,
Is there a way to access values return from a table-valued function?
Sample code:
CREATE FUNCTION [dbo].[fn_MyFunction]
(@ID INT)
RETURNS @return_table TABLE
(Col1 int NULL,
Col2 int NULL)
AS
--- processing goes here...
INSERT @return_table
SELECT @col1_newvalue,@col2_newvalue
RETURN
Need to call above function from stored procedure as follows;
CREATE procedure MyProc
AS
SELECT col1, col2 from dbo.fn_MyFunction(1)
-- want to store return values for further processing by assigning them to local variables
declare @newvalue1 int
declare @newvalue2 int
set @newvalue1 = col1
set @newvalue2 = col2
--- start processing @newvalue1 and @newvalue2 further
Is this possible in SQL 2005?
Thanks in advance.
↧
Can this linear regression algorithm for SQL Server 2K5 be made reusable?
The following block of code calculates the formula for a trend line using linear regression (method of least squares). It takes as its input two columns of data (i.e. a table) representing the x and y axes of a chart. It's output could be a single row (3 cols) of data representing the slope and y-intercept of the trendline, and the correlation coefficient.
Is there a way in SQL 2K5 to create an in-line table-valued function, or a stored procedure that can take a table of x and y coordinates as a parameter? Is there some other way to make this code reusable. Otherwise whenever I want a trendline in the reporting client (SSRS 2008 R2) I'm going to have to copy/paste/hack this code into my work.
Supplementary questions:
Are there any gotchas in using the float data type here?
Often the x axis will be datetime (eg week starting on mm/dd/yyyy). Are there any gotchas in converting a datetime to a numeric?
--======= =================================================================================================
--======= Author: (originally) http://stackoverflow.com/users/92092/stephan See:
--======= http://stackoverflow.com/questions/2536895/are-there-any-linear-regression-function-in-sql-server
--======= Date: Mar 29 2010 09:58
--======= Purpose: Linear regression (method of least squares)
--======= Comments:
--======= Revisions: WHO WHEN WHAT
--======= GPO 20121216 Simplified query (well... kinda) to limit calcs to one
--======= regression equation per input dataset.
--======= =================================================================================================
SET NOCOUNT ON
--------- test data
IF OBJECT_ID('tempdb..#some_table') IS NOT NULL
DROP TABLE #some_table;
SELECT 0 as sourceID, 1.2 as x, 1.0 as y
INTO #some_table
UNION ALL SELECT 1, 1.6, 1
UNION ALL SELECT 2, 2.0, 1.5
UNION ALL SELECT 3, 2.0, 1.75
UNION ALL SELECT 4, 2.1, 1.85
UNION ALL SELECT 5, 2.1, 2
UNION ALL SELECT 6, 2.2, 3
UNION ALL SELECT 7, 2.2, 3
UNION ALL SELECT 8, 2.3, 3.5
UNION ALL SELECT 9, 2.4, 4
UNION ALL SELECT 10, 2.5, 4
UNION ALL SELECT 11, 3, 4.5;
--======= =================================================================================================
--======= linear regression query
--======= Get average x====================================================================================
DECLARE @xbar as float;
SET @xbar = ( SELECT avg(x)
FROM #some_table
);
--======= Get average y====================================================================================
DECLARE @ybar as float;
SET @ybar = ( SELECT avg(y)
FROM #some_table
);
--======= Get beta (slope) estimate========================================================================
DECLARE @Beta as float;
SET @Beta = ( SELECT SUM((x-@xbar)*(y-@ybar))
/ --nullif to stop divided by zero
nullif(SUM((x-@xbar)*(x-@xbar)),0)
FROM #some_table pd
);
--======= Get alpha (constant) estimate====================================================================
DECLARE @Alpha as float;
SET @Alpha = @ybar - @xbar * @Beta;
--======= Get Total Sum of Squares=========================================================================
DECLARE @SS_tot as float;
SET @SS_tot = ( SELECT SUM((y-@ybar)*(y-@ybar))
FROM #some_table
);
--======= Get Total Sum of Squares due to Error============================================================
DECLARE @SS_err as float;
SET @SS_err = ( SELECT SUM((y-(@Alpha+@Beta*x)) * (y-(@Alpha+@Beta*x)))
FROM #some_table
);
--======= Get r-squared (the correlation coefficient)======================================================
DECLARE @r_squared as float;
SET @r_squared = CASE WHEN @SS_tot = 0
THEN 1.0
ELSE 1.0 - (@SS_err / @SS_tot)
END;
--======= Joining back to the source data allows the plotting of of the trend line along with the usual
--======= plotting of x against y==========================================================================
SELECT sourceID
,x
,y
,@Beta * x + @Alpha as y_trend
--------- the final output from the sproc/iltvf could be a single row holding the following three values.
,@r_squared as r_squared
,@Alpha as Alpha
,@Beta as Beta
FROM #some_table;
↧
SSIS 2005 connection manager issues
I have a project with about 30 separate Pkgs. Each pkg has 5 connection managers to the same 5 connections. These connections are in a config file and each package is pointing to the same config file. Each time I open the project and then one of the packages, one or more of the connection managers receive the error: > ssis error code> dts_e_cannotacquireconnectionfromconnectionmanager.> the acquireconnection method
When I reopen the config file, one or more of the connections is no longer checked to be in the config file. How does this happen?
I am a bit confused on all the encrypt/ don't encrypt protection level, True/false delay validation and the 64 vs 32 bit properties that can be set and how that affects connection managers. I can't seem to find consistency for the settings among opinions and answers. Is there a standard from which to start?
I have a windows 2003 server with 2005 sql and BIDs. How do I determine if I am running in 32-bit or 64? Is this something set in both sql server, windows server and BIDS?
↧
↧
SQL Server 2005 service startup is failed
I have both Sql server 2005 Standard and 2008 Express Edition servers.
When i start SQL Server 2005 service, it throws error.(SQL server 2008 working fine)
Error : Could not start SQL Server(SQLEXPRESS)service on Local Computer.
Error 1053: The service did not respond to start or control request in a timel fashion.
Detailed Screen shots were below shown.
![alt text][1]
alt text
![alt text][2]
[1]: /storage/temp/537-1.jpg
[2]: /storage/temp/540-3.jpg
Thanks,
Muniprasad
↧
code incomplete please help
here is the data
Wat i wat is a little strange most of you will undestand from the code
> SET XACT_ABORT, NOCOUNT ON;>> BEGIN TRY>> BEGIN TRAN>> DECLARE @Members TABLE (memb_id> VARCHAR(10))>>> UPDATE MEMBINFO SET cspoints => a.cspoints + b.PCPoints OUTPUT > INSERTED.memb_id> INTO @Members FROM [CHARACTER] b> INNER JOIN [MEMBINFO] a> ON b.AccountID = a.memb_id>> UPDATE [CHARACTER] SET PCPoints => 0 WHERE AccountID IN ( SELECT > memb_id> FROM @Members AS M )>>> IF @@TRANCOUNT > 0 COMMIT TRAN END> TRY BEGIN CATCH>> SELECT ERROR_MESSAGE(), ERROR_LINE()> IF @@TRANCOUNT > 0 AND XACT_STATE <> 0> ROLLBACK TRAN>> END CATCH
The code was made by usmabut .. and has a glich ,(Bug) , woks fine when the player on my server has on his AccountID only one Name (character ) but the problem is that the player can create 5 of these characters [Name] on one [AccountID] so 5 difrente Name with the same ACCOUNT id ...
Problem in the code is that we he opens a new characters and has 1 PCPoints bug the code no conversion to any of the players
Wat i need is to ADD first all PCPpoints from the ALL Name in the Character table with the same AccountID then the result add with cspoints from MEMB_INFO is with the same AccountID (From Character) = memb___id (From MEMB_INFO) > TotalPCpoints from Character + cspoints = TotalCSpoints after that Set PCPoints 0
can any one help please for more details i am here
here tables
> USE [MuOnline]>> GO>>> /****** Object: Table> [dbo].[Character] Script Date:> 06/12/2012 01:32:46 **/>> SET ANSI_NULLS ON>>> GO>>> SET QUOTED_IDENTIFIER ON>>> GO>>> SET ANSI_PADDING ON>>> GO>>> CREATE TABLE [dbo].[Character](>>> [AccountID] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,>>> [Name] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL,>>> [cLevel] [int] NULL CONSTRAINT [DF_Character_cLevel] DEFAULT ((1)),>>> [LevelUpPoint] [int] NULL CONSTRAINT [DF_Character_LevelUpPoint]> DEFAULT ((0)),>> [Class] [tinyint] NULL,>>> [Experience] [int] NULL CONSTRAINT [DF_Character_Experience] DEFAULT> ((0)),>> [Strength] [smallint] NULL,>>> [Dexterity] [smallint] NULL,>>> [Vitality] [smallint] NULL,>>> [Energy] [smallint] NULL,>>> [Inventory] [varbinary](1728) NULL,>>> [MagicList] [varbinary](180) NULL,>>> [Money] [int] NULL CONSTRAINT [DF_Character_Money] DEFAULT ((0)),>>> [Life] [real] NULL,>>> [MaxLife] [real] NULL,>>> [Mana] [real] NULL,>>> [MaxMana] [real] NULL,>>> [MapNumber] [smallint] NULL,>>> [MapPosX] [smallint] NULL,>>> [MapPosY] [smallint] NULL,>>> [MapDir] [tinyint] NULL CONSTRAINT [DF_Character_MapDir] DEFAULT ((0)),>> [PkCount] [int] NULL CONSTRAINT [DF_Character_PkCount] DEFAULT ((0)),>> [PkLevel] [int] NULL CONSTRAINT [DF_Character_PkLevel] DEFAULT ((3)),>> [PkTime] [int] NULL CONSTRAINT [DF_Character_PkTime] DEFAULT ((0)),>>> [MDate] [smalldatetime] NULL,>>> [LDate] [smalldatetime] NULL,>>> [CtlCode] [tinyint] NULL CONSTRAINT [DF_Character_CtlCode] > DEFAULT ((0)),>> [DbVersion] [tinyint] NULL CONSTRAINT> [DFCharacterDbVer__3A4CA8FD]>> DEFAULT ((0)),>> [Quest] [varbinary](50) NULL CONSTRAINT> [DFCharacterQuest__40F9A68C]>> DEFAULT ((0)),>> [Leadership] [smallint] NULL CONSTRAINT> [DFCharacterLeade__6FB49575]>> DEFAULT ((0)),>> [ChatLimitTime] [smallint] NULL CONSTRAINT> [DFCharacterChatL__70A8B9AE]>> DEFAULT ((0)),>> [FruitPoint] [int] NULL CONSTRAINT [DFCharacterFruit__44CA3770]>> DEFAULT ((0)),>> [JHDX] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL,>>> [JHtype] [tinyint] NULL,>>> [cspoints] [int] NULL,>>> [Grand_Resets] [int] NOT NULL CONSTRAINT> [DFCharacterGrand__42E1EEFE]>> DEFAULT ((0)),>> [mu_id] [int] IDENTITY(1,1) NOT NULL,>>> [Resets] [int] NOT NULL CONSTRAINT [DFCharacterReset__43D61337]>> DEFAULT ((0)),>> [EDSPostCmd] [int] NOT NULL CONSTRAINT [DF_Character_EDSPostCmd] > DEFAULT ((0)),>> [CirePkRank] [int] NOT NULL CONSTRAINT [DF_Character_CirePkRank] > DEFAULT ((0)),>> [EDSPostBanTime] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL> CONSTRAINT>> [DFCharacterEDSPostBanTime] DEFAULT>> ((0)),>> [Married] [tinyint] NOT NULL CONSTRAINT [DF_Character_Married] > DEFAULT ((0)),>> [MarryName] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL,>>> [GensRank] [smallint] NOT NULL CONSTRAINT [DF_Character_GensRank] > DEFAULT ((0)),>> [GensContribution] [int] NOT NULL CONSTRAINT> [DFCharacterGensContribution]>> DEFAULT ((0)),>> [GensType] [tinyint] NOT NULL CONSTRAINT [DF_Character_GensType] > DEFAULT ((0)),>> [GensLastLeave] [int] NOT NULL CONSTRAINT [DFCharacterGensLastLeave]> DEFAULT>> ((0)),>> [GensKnight] [tinyint] NOT NULL DEFAULT ((0)),>>> [PCPoints] [int] NOT NULL DEFAULT ((0)),>>> [TempPcPoints] [int] NOT NULL DEFAULT ((0)),>>> CONSTRAINT [PK_Character] PRIMARY KEY> NONCLUSTERED >>> (>>> [Name] ASC>>> )WITH (IGNORE_DUP_KEY = OFF) ON> [PRIMARY]>>> ) ON [PRIMARY]>>>>>> GO>>> SET ANSI_PADDING OFF USE [MuOnline] GO> /** Object:>> Table [dbo].[MEMB_INFO] Script>> Date: 06/12/2012 01:33:04 **/ SET>> ANSINULLS ON GO SET QUOTEDIDENTIFIER>> ON GO SET ANSI_PADDING ON GO CREATE>> TABLE [dbo].[MEMB_INFO](>> [memb_guid] [int] IDENTITY(1,1) NOT> NULL,>>> [memb___id] [varchar](10) COLLATE> Chinese_PRC_CI_AS NOT NULL,>>> [memb__pwd] [varchar](10) COLLATE> Chinese_PRC_CI_AS NOT NULL,>>> [memb_name] [varchar](10) COLLATE> Chinese_PRC_CI_AS NOT NULL,>>> [sno__numb] [char](13) COLLATE> Chinese_PRC_CS_AS_KS_WS NOT NULL,>>> [post_code] [char](6) COLLATE> Chinese_PRC_CS_AS_KS_WS NULL,>>> [addr_info] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [addr_deta] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [tel__numb] [varchar](20) COLLATE> Chinese_PRC_CI_AS NULL,>>> [phon_numb] [varchar](18) COLLATE> Chinese_PRC_CI_AS NULL,>>> [mail_addr] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [fpas_ques] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [fpas_answ] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [job__code] [char](2) COLLATE> Chinese_PRC_CI_AS NULL,>>> [appl_days] [datetime] NULL,>>> [modi_days] [datetime] NULL,>>> [out__days] [datetime] NULL,>>> [true_days] [datetime] NULL,>>> [mail_chek] [char](1) COLLATE> Chinese_PRC_CI_AS NULL CONSTRAINT> [DFMEMBINFOmailchek] DEFAULT>> ((0)),>> [bloc_code] [char](1) COLLATE> Chinese_PRC_CI_AS NOT NULL,>>> [ctl1_code] [char](1) COLLATE> Chinese_PRC_CI_AS NOT NULL,>>> [JF] [int] NULL CONSTRAINT> [DF__MEMB_INFO__JF__10566F31] DEFAULT> ((0)),>> [servercode] [int] NOT NULL CONSTRAINT> [DF_MEMB_INFO_servercode] DEFAULT> ((0)),>> [dingdan] [varbinary](50) NULL,>>> [usedtime] [int] NOT NULL CONSTRAINT> [DF_MEMB_INFO_usedtime] DEFAULT> ((0)),>> [cspoints] [int] NULL CONSTRAINT> [DF_MEMB_INFO_cspoints] DEFAULT> ((0)),>> [activation_id] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [confirmed] [int] NULL,>>> [Country] [nvarchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [Gender] [int] NULL,>>> [SecretAnswer] [varchar](100) COLLATE> Chinese_PRC_CI_AS NULL,>>> [SecretQuestion] [int] NULL,>>> [VipStat] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [VipStamp] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [MasterKey] [varchar](10) COLLATE> Chinese_PRC_CI_AS NULL,>>> [AccountLock] [tinyint] NULL> CONSTRAINT [DFMEMBINFOAccou_2AD55B43]>> DEFAULT ((0)),>> [Remark] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [TempCredits] [int] NULL CONSTRAINT> [DFMEMBINFOTempC_2BC97F7C]>> DEFAULT ((0)),>> [memb__pwd2] [varchar](50) COLLATE> Chinese_PRC_CI_AS NULL,>>> [votes] [int] NOT NULL CONSTRAINT> [DF__MEMB_INFO__votes__6E8B6712] > DEFAULT ((0)), CONSTRAINT>> [PKMEMBINFO] PRIMARY KEY>> NONCLUSTERED (>> [memb___id] DESC )WITH (IGNORE_DUP_KEY> = OFF) ON [PRIMARY] ) ON [PRIMARY]>> GO SET ANSI_PADDING OFF
↧
query out in sql server 2005 giving error incorrect host column number found in bcp format file
please help me in this regard .
Im exporting data from sql table to text with format file , but getting the above mention error , same file is used for bulk insert , insert was successfull..
Regards
↧
Hello I want the output like attachment in sql server........ so help me to make a stored procedure
[link text][1]
[1]: /storage/temp/584-new+text+document.txt
Hello I want the output like this in sql server........
so help me to make a stored procedure
↧
↧
Getting Error while running application on sql server 2005 on win server 2008 as drive is full where the .mdf and .ldf files r located
I am running sql server 2005 on windows server 2008. I had .mdf and .ldf file in drive E: which is now showing full(0 bytes free). I also have F: drive(External USB drive) which has a lots of free space. I want to move .ldf/.mdf to C: drive or if possible F: drive because while running the application it is giving error. The other local drive is C: which is 17 GB free. .mdf is 750 mb and . ldf is 230 GB, so big.Also when I am trying to run a query it is not letting me use the same database, it is coming back to masters.Please tell me the steps. As am new to SQL please guide me like a beginner. Help will be greatly appreciated.
Please reply people. Its been a day now
Thanks in advance
↧
get field x in database with sql query
i hope someone can you help me:
I have 4 table as below:
1/ IMS
2/ Daily
3/ Weekly
4/ Monthly
get field X with sql language.
X = Weekly::K (relationship la monthly1 = weekly1)
K = a1+a2+a3+a4+a5+a6
**Weekly and Daily table**
a1 = Daily::b1 (relationship weekly_1 = daily_1)
a2 = Daily::b2 (relationship weekly_2 = daily_1)
a3 = Daily::b3 (relationship weekly_3 = daily_1)
a4 = Daily::b4 (relationship weekly_4 = daily_1)
a5 = Daily::b5 (relationship weekly_5 = daily_1)
a6 = Daily::b6 (relationship weekly_6 = daily_1)
**Daily and Ims table**
b1 = sum(IMS::c) (relationship daily_1 = ims_1)
b2 = sum(IMS::c) (relationship daily_2 = ims_1)
b3 = sum(IMS::c) (relationship daily_3 = ims_1)
b4 = sum(IMS::c) (relationship daily_4 = ims_1)
b5 = sum(IMS::c) (relationship daily_5 = ims_1)
b6 = sum(IMS::c) (relationship daily_6 = ims_1)
Thank you very much.
↧
how to get the value used in SP or Views or Functions or SQL Jobs?
Hi,
Another Challenge/New things to learn i have scenario like
**I want to list the
stored procedures,view,Function ,SQL jobs if used the IP address inside the stored
procedure/views/Function/ SQL jobs**.
Is it possible to get?
I have one sample below for understanding the concept
sample function:
CREATE FUNCTION [dbo].[GetclientIP] ()
RETURNS varchar(255)
AS
BEGIN
DECLARE @IP_Address varchar(255);
SELECT @IP_Address = client_ip_address
FROM clientaddress---sample table
WHERE Session_id = 192.168.1.78
Return @IP_Address;
END
The above Function used the ip address '192.168.1.78'. so I want to list out **if Any of IP
Address SP/Views/function/sql jobs used means I want to list out**
↧